Here are notes for passwords in mySQL
Change password
mysql --user=myloginname --password=oldpassword targetdatabase
SET PASSWORD=PASSWORD('new_password');
Add New User
# mysql --user=root mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO allan@localhost
-> IDENTIFIED BY 'pasword' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO allan@"%"
-> IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost;
mysql> GRANT USAGE ON *.* TO nobody@localhost;
These GRANT statements set up three new users:
allan
A full superuser who can connect to the server from anywhere, his password is 'password to do so.
admin
A user who can connect from localhost without a password and who is granted the reload and process
administrative privileges.
nobody
A user who can connect without a password, but only from the local host.
Forget root password
Start mysql with --skip-grant-tables
update user set password=password('password') where user='root' and
host='localhost';
Restart mysql
root password is password
Author Larry Apolonio larry_apolonio@nospa.m.minihowto.com Updated April 23, 2002
Do not email me at psam@minihowto.com