View Full Version : how to change mysql root password

11-16-2002, 04:28 AM
i downloaded the phpdev423 bundle from

after installed it, i understand that by default, MySQL has no security. I just want to know how to change the root password? What should i do to secure the server if it's connected to the internet, to prevent it being compromised by hackers?

can anyone give me a step-by-step guide on how to configure the settings to make it more secure?

Thanks in advanced.

11-16-2002, 11:27 AM
First of all you should remove the anonymous user from mySQL by logging into mySQL then running this sql:

mysql> DELETE FROM user WHERE host='localhost' AND user='';

Quit mySQL and from the command line run the following (make sure you are in the mysql\bin directory):

mysqladmin reload

This reloads all the table information and therefore removing the anonymous user.

Next, still in the command line:

mysqladmin -u root password <your new password>

This sets a password for the root user (admin) and your job is done :)

If you wan to see the priveleges set for user, db's and tables then simply view the tables in the mysql database with so sql:

e.g. select user,host from users;

Hope this helps you - JaYsuN