• mac 第一次安装mysql 5.7.12 不知道root 密码的解决办法


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

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

    3     sudo ./mysqld_safe --skip-grant-tables

    5.    mysql -u root

    6.    update mysql.user set authentication_string='' where user='root'; 

    7.    flush privileges;

    修改密码:
    注意:MySQL 5.7版本中user表中的密码字段列名称变了,从password变成了authentication_string了,所以MySQL5.7之前的版本用以下命令来修改:
    $ update mysql.user set password=password('123456') where user='root';
    MySQL5.7之后使用以下命令来修改:
    $ update mysql.user set authentication_string='' where user='root';
    至此修改成功。
    如果可以进入,但是随便执行一条语句依然报错(ERROR 1820 (HY000): You must SET PASSWORD before executing this statement)则按照如下再次设置密码:
    $ set password for root@localhost=password('12345');
    设置完之后,就可以正常建表、查询使用了。

  • 相关阅读:
    开发记录4
    开发记录3
    豆瓣的基础架构读后感
    开发记录2
    开发记录1
    大数据技术大作业1
    新浪微博平台架构读后感
    第一阶段冲刺第五天
    第一阶段冲刺第四天
    第一阶段冲刺第三天
  • 原文地址:https://www.cnblogs.com/btdxqz/p/6820515.html
Copyright © 2020-2023  润新知