These are a few tips on setting passwords in MySql from the Linux command line I figured out while setting up a MySql db server.
To set the root password run this: “mysql -u root mysql” Then run this query: “SET PASSWORD FOR root@localhost=PASSWORD(’password‘);” at the MySql prompt replacing the italics with the password.
Then run this command to connect to the database: “mysql -u root -p mysql” and enter your password.
Also to completely wipe everything associated with the database run “rm -rf /var/lib/mysql/*” and restart MySql server (/etc/init.d/mysqld start). This can be helpful to reset a forgotten root password, although there are less destructive ways.
0 Responses to “MySql password tips”
Leave a Reply