您的位置:首页 > 博客中心 > 数据库 >

mysql: reinit the password

时间:2022-03-16 11:18

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.

answered Aug 23 ‘16 at 12:11 技术分享图片 1464
 
    
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 . (Mint 18, mysql 5.7) –  

本类排行

今日推荐

热门手游