关于mac系统中进入mysql遇到 Access denied for user 'root'@'localhost' (using password: YES

2022-08-08 08:45:40 浏览数 (1)

  Access denied for user 'root'@'localhost' (using password: YES)

  usering password:YES 其实不用怀疑,密码输入正确,既然不是密码的问题那就是mysql服务出问题了,具体解决流程如下:

  1) Stop mysql (Kill mysql process or run following command) 停止mysql服务

        sudo /usr/local/mysql/support-files/mysql.server stop

      2) Start it in safe mode 用安全模式进入mysql 这一步可以看成是不输入密码就进入mysql命令行

        sudo mysqld_safe --skip-grant-tables

      3) Open another terminal and run the following command (Keep last terminal open) 在另一个窗口中进入mysql         mysql -u root

       4) Run the following command with suitable new password on the mysql console 修改密码

        mysql > UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';

       5) mysql > FLUSH PRIVILEGES; 刷新一下缓存

0 人点赞