码迷,mamicode.com
首页 > 数据库 > 详细

mysql: reinit the password

时间:2018-01-04 11:06:49      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:--   avatar   direct   change   over   details   rect   socket   ges   

You can reinit the password :

1.stop mysql

/etc/init.d/mysql stop

2.start mysql safe :

mysqld_safe --skip-grant-tables &

3.connect to mysql

mysql -u root

4.change the password

mysql> use mysql;
mysql> update user set password=PASSWORD(”YOUR_PASSWORD”) where user=’root’;
mysql> flush privileges;
mysql> quit

5.stop mysql

/etc/init.d/mysql stop

6.start mysql

/etc/init.d/mysql start

Then you can connect to mysql with login root and the new password.

shareimprove this answer
 
    
Trying to use mysqld_safe resulted in SOCKET file errors. I was able to fix these by manually making the directory and then giving it to the mysql user. See this answer. (Mint 18, mysql 5.7) – Deleet Sep 20 ‘17 at 10:33

mysql: reinit the password

标签:--   avatar   direct   change   over   details   rect   socket   ges   

原文地址:https://www.cnblogs.com/ilovewindy/p/8191226.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!