How do I set a password for my administrator?
External command Set Password
Mysqladmin-uroot password= ' own password to set '
SQL statement Set password
Mysql>update Mysql.user set Password=password ("Password you want to set") where user= ' root ' and host= ' localhost '
How do I forget a single-instance password?
Turn off MySQL
/etc/init.d/mysqld stop
Start with parameters
Mysqld_safe--skipgrant-tables--user=mysql &
Blank Password Login
Mysql-uroot
Change Password
Mysql>update Mysql.user set Password=password ("password") where user= ' root ' and host= ' localhost '
Refresh Permissions
mysql> flush Privileges;
Turn off MySQL, restart
Mysqladmin-uroot-ppassword shutdown
/etc/init.d/mysqld start
How does a multi-instance forgotten password work?
Turn off MySQL
Killall MySQL #只能killall myqld, because when the password is closed, your password has been forgotten
2. Add parameters at startup
Mysqld_safe--defaults-file=/data/3306/my.cnf--skip-grant-tables &
3. Login Time-space password
Mysql-uroot-s/data/3306/data/mysql.sock
4. Change the password
Mysql>update Mysql.user Set Password=password ("NewPassword") where user= ' root ' and host= ' localhost '
5. Don't forget to refresh
mysql> flush Privileges;
6. Then close MySQL, login with the new password is OK.
Mysqladmin-uroot-pnewpassword-s/data/3308/data/mysql.sock shutdown
This article is from the "Linux operation and Maintenance" blog, reproduced please contact the author!
What should I do if I forgot my password?