Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What should I do if mysql forgets my password?

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

How do I set a password for an administrator?

External command sets password

Mysqladmin-the password to be set by uroot password=' yourself'

Sql statement to set password

Mysql > update mysql.user set password=password ("password you want to set") where user='root' and host='localhost'

How do I forget my password for a single instance?

Close mysql

/ etc/init.d/mysqld stop

Start with parameters

Mysqld_safe-skipgrant-tables-user=mysql &

Login with empty password

Mysql-uroot

Change the password

Mysql > update mysql.user set password=password ("password") where user='root' and host='localhost'

Refresh permissions

Mysql > flush privileges

Shut down mysql and restart

Mysqladmin-uroot-ppassword shutdown

/ etc/init.d/mysqld start

How do I forget my password for multiple instances?

Close mysql

Killall mysql # can only killall myqld, because you need a password when you turn it off. Your password has been forgotten.

two。 Add parameters at startup

Mysqld_safe-defaults-file=/data/3306/my.cnf-skip-grant-tables &

3. Login space-time password

Mysql-uroot-S / data/3306/data/mysql.sock

4. Modify 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 and log in to ok with a new password.

Mysqladmin-uroot-pnewpassword-S / data/3308/data/mysql.sock shutdown

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report