我爱编程

mysql 设置、更改、找回密码

2018-04-16  本文已影响0人  名白

1,新装mysql,添加密码

mysqladmin -u root password NEWPASSWORD

2,记得旧密码,改密码

mysqladmin -u root -p'OLDPASSWORD' password NEWPASSWORD

3,不记得旧密码,新设密码

  1. Stop the MySQL server process with the command: sudo service mysql stop
  2. Start the MySQL server with the command: sudo mysqld_safe —skip-grant-tables —skip-networking &
  3. Connect to the MySQL server as the root user with the command: mysql -u root

At this point, you need to issue the following MySQL commands to reset the root password:

mysql> use mysql;
​mysql> update user set authentication_string=password('NEWPASSWORD') where user='root';
​mysql> flush privileges;
​mysql> quit
上一篇 下一篇

猜你喜欢

热点阅读