How to Set your MySQL Password

From Brian Nelson Ramblings
Jump to: navigation, search

How to Set your MySQL Password

One of the first things you should do on any MySQL install is set the root password. If you do not set the password anyone that gains access to your system will have access to everything in the database.

Set root password

Make sure to start Percona/Mysql

service mysql start

Log into mysql and check the users

mysql -u root
SELECT User, Host, Password FROM mysql.user;

Now set the root passwords

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('briansnelson');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('briansnelson');
SET PASSWORD FOR 'root'@'localhost.localdomain' = PASSWORD('briansnelson');
FLUSH PRIVILEGES;