当前位置:首页 > 操作系统 > MacOs

Mac下解决mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Go to mysql/bin directory

<code>$ cd /usr/bin
</code>

Start a mysql deamon with this option:

<span style="color: #ff0000"><code>$ sudo mysqld_safe --skip-grant-tables
</code></span>

Open another terminal and open a mysql session to execute this:

<code><span style="color: #ff0000">$ mysql

mysql> use mysql;</span>

see Note1 below for next line.
<span style="color: #ff0000">mysql> UPDATE user SET authentication_string=PASSWORD(‘YOUR_NEW_PASSWORD_HERE‘) WHERE user = ‘root‘;</span>

<span style="color: #ff0000">mysql> exit;
</span></code>

Now kill the mysqld_safe process and restart mysqld normally:

<span style="color: #ff0000"><code>$ sudo service mysqld start
</code></span>

Note1: password is the column name in table mysql.user prior to version 5.7. After which it became authentication_string. Change your update statement accordingly.

如何你们看不懂,给我留言,我教你。

 

Mac下解决mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

标签:5.7   director   mysql   update   restart   name   code   rect   min   

本文系统来源:http://www.cnblogs.com/vector11248/p/6680509.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐