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

    xiaoxiao2021-03-26  39

    在mac电脑安装完mysql之后安装方法不做介绍了。

    我安装的是目前最新版本mysql-5.7.17-macos10.12-x86_64.dmg

    然后设置root密码的时候报错

    查询了好多种方法都不见效,最后放下了一个见效的方法

    1.    先从系统偏好设置里 把 mysql 停掉

    2.    打开mac 命令行工具,sudo su 以管理员身份运行命令

    3.    cd /usr/local/mysql/bin     (mysql的安装目录)

    4.    ./mysqld_safe --skip-grant-tables &

    5.    ./mysql -p  ------直接回车就进去了

    6.    mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

    7.    flush privileges;

    做完所有以上步骤再从workbench基本输2次密码就可以连上了

    第5步很重要,因为网上很多人写的第5步是通过workbench 重置密码,我自己尝试无效,不知道是不是版本的问题

    转载请注明原文地址: https://ju.6miu.com/read-662040.html

    最新回复(0)