愚蠢的人类忘记了mysql root的密码

2017-04-20  本文已影响0人  woodsouthmmm

stop the MySQL server (two ways)

reset the password

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

open another terminal

$sudo /usr/local/mysql/bin/mysql -u root

input the system password

$ UPDATE mysql.user SET authentication_string=PASSWORD('新密码') WHERE User='root';
$FLUSH PRIVILEGES;
$\q

ref

http://devlu.me/2016/01/18/Mac%E4%B8%8B%E9%87%8D%E7%BD%AEMysql%E7%9A%84root%E5%AF%86%E7%A0%81/
https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html( the manual documentation seems complicated but more detailed.

上一篇 下一篇

猜你喜欢

热点阅读