How to Set your MySQL Password

From Brian Nelson Ramblings
Revision as of 18:02, 12 March 2014 by Brian (Talk | contribs) (Created page with "==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 acce...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

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;