Getting started with MySQL under Windows

from the Artful MySQL Tips List


To make life easier, create a desktop icon for a DOS window that opens in the mysql bin folder, eg if mysql is installed on c:, and if you accepted the defaults when installing version 5.1 of the server, your icon will open a DOS window over ...

C:\Program Files\MySQL\MySQL Server 5.1\bin

When you have that icon working, use it, then issue the command

net stop mysql

which will do what it says if MySQL is running as a network service. (If it is not, reboot the machine without any autoexec command that would start the server, then open a DOS window as above.) Now run

mysqld-nt --skip-grant-tables

which starts the server without usernames & passwords. Now open a 2nd instance of your DOS window and issue this cmd:

mysql

to start the MySQL client, and in it issue

use mysql;
select host,user,password from user;

Inspect the list to see if there is a user named 'root'. If there is, its host is likely 'localhost', its password is likely blank, and if you have not edited the 'root' user row, 'root' has all possible privileges. Those are the privileges you want, but 'root' should have a password, so give her one:

UPDATE user
SET password=PASSWORD('yourdesiredpassword')
WHERE user='root';

which will permit you to login from any functioning mysql client with username 'root' and your password.

Now exit from the mysql client:

exit

If you have not installed MySQL as a service, do it now with

mysqld --install

Issue these DOS cmds:

mysqladmin shutdown
net start mysql

and you should be ready to roll.

Return to the Artful MySQL Tips page