MySQL

What is MySQL?

MySQL is the most used database software in Open Source. It is developed and maintained by T.C.X DataKonsult AB of Stockholm, Sweden. MySQL is extremely fast. If you need speed then MySQL is probably your best choice, if you need some of the extra features that PostgreSQL can offer you should use PostgreSQL.

Anything is not perfect. MySQL does not support transactions, stored procedures, triggers, foreign keys, and views at the moment. PostgreSQL has some more advanced features like user-defined types, triggers, rules and some transaction support. But it is really stable and reliable relational database software, which is proved by millions of users around the world.

Installation of MySQL

1. Download the latest MySQL version at http://www.mysql.com .
2. Unzip and install it.
3. Check the file c:\my.cnf .

Start MySQL

Windows 9x
To start the mysqld server, you should start an MS-DOS window and type:
C:\mysql\bin\mysqld
This will start mysqld in the background without a window.

You can kill the MySQL server by executing:
C:\mysql\bin\mysqladmin -u root shutdown

For NT / Win2000, the server name is mysqld-nt. Normally you should install MySQL as a service on NT/Win2000:
C:\mysql\bin\mysqld-nt --install
(You could use the mysqld or mysqld-opt servers on NT, but those cannot be started as a service or use named pipes.) You can start and stop the MySQL service with: NET START mysql and NET STOP mysql

Linux
not yet.

Tutorial

Set up an administrator password
..\mysql\bin> mysqladmin -u root password yourpassword

Run MySql
..\mysql\bin> mysql -u root -pyourpassword mysql

Run a batch file
..\mysql\bin> mysql -u user -p databasename < mysqlbatch.sql

Dump the database
>mysqldump -h hostname -u root -pyourpassword databasename > databasedump.dump
>mysqldump -h hostname -u root -pyourpassword databasename tablename> dbtablenamedump.dump
-t dump only the data from tables
-d dump only the table structure

Web Sites

Official Site
A lot of MySQL tutorials
MySQL JDBC

Transaction

The main reason we went with atomic operations as opposed to transactions is that by doing this we could apply many speed optimizations that would not otherwise have been possible.

Lastly, in situations where integrity is of highest importance, MySQL's current features allow for transaction-level or better reliability and integrity. If you lock tables with LOCK TABLES, all updates will stall until any integrity checks are made. If you only obtain a read lock (as opposed to a write lock), then reads and inserts are still allowed to happen. The new inserted records will not be seen by any of the clients that have a READ lock until they relaease their read locks. With INSERT DELAYED you can queue inserts into a local queue, until the locks are released, without having to have the client wait for the insert to complete.