Friday, 5 August 2011

Setting the Root Password

As you probably noticed when you logged in just now, you had to supply a username—root—but not a password. The initial installation of MySQL has no root password set. It's really important to set this password for obvious security reasons. In the MySQL monitor, type the following:

set password for root@localhost=password('your password');

Obviously, you should replace your password with whatever you would like the root password to be.

Log out (\q) and then log back in. This time, you need to log in like this:

mysql -u root -p

MySQL then prompts you for your password. The -u means username, and the -p means log in with password.

No comments:

Post a Comment