Before starting the MySQL client make sure the server is turned on. If you run Windows 9x start the mysqld.exe or if you run Windows 2000/XP run the mysqld-nt.exe
The --console option tells mysqld-nt not to remove the console window. if you are running Windows NT/2000/XP it's better to install MySQL as a service. That way mysql server will be automatically started when you start Windows.
Use mysqld-nt --install to install mysqld as a service and mysqld-nt --remove to remove mysqld from the service list
Once the server is on, open another DOS window and type mysql, you should see something like this
C:\>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Or if you need to specify a user name and password you can start mysql like this :
C:\>mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
You can also specify the database you want to use. If you already have a database named petstore you can start mysql as
C:\>mysql petstore
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Once you're done you can end mysql client by typing quit or exit at the mysql> prompt
mysql> exit
Bye
C:\>
Note : If you get this kind of error message when trying to run mysql from the DOS window
C:\>mysql
'mysql' is not recognized as an internal or external command,
operable program or batch file.
that means you haven't set the path to mysql bin directory. To solve the problem you can add the following line to your autoexec.bat file :
path=%path%;c:\mysql\bin
assuming that you install MySQL in c:\mysql. Or if you're using Windows XP you can go to :
Start->Settings->Control Panel->System->Advanced->Environment Variables
Chose Edit on the System Variables section and add c:\mysql\bin to the path environment variable.
Saturday, March 22, 2008
Starting MySQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment