Tuesday, August 21, 2007

MySQL Quick Start

In one command window, first change to the MySQL bin folder then start mysqld, the MySQL service.
1.  c:\dev>cd \program files\mysql\mysql server 5.0\bin
2.  C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqld --console
In a second command window, again change to the MySQL bin folder and now start your session.
1.  c:\dev>cd \progra~1\mysql\mysql server 5.0\bin
2.  C:\PROGRA~1\MySQL\MySQL Server 5.0\bin>mysql -u root -p
3.  Enter password: ****
At this point, you can enter SQL statements. Often, the first statement is to connect to a database.
1.  mysql> connect firstdb
2.  mysql> display tables;
Sometimes, you may need to create a database:
mysql> create database firstdb;
You would then connect to it as shown above. To exit, simply type
mysql>quit