您当前的位置: 首页 >  sql

Dongguo丶

暂无认证

  • 0浏览

    0关注

    472博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

操作mysql报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement

Dongguo丶 发布时间:2018-03-18 21:12:55 ,浏览量:0

安装完成后,使用安装过程随机生成的密码登录,执行命令都是失败的,都会给出如下提示

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. 1 查阅资料后才知道,原来是Password Expiration Policy搞的鬼,自从5.7.4版本后就有了这么一个东西(详情参考最后的参考网站)。执行下面的代码可解。

mysql> SELECT 1; ERROR 1820 (HY000): You must SET PASSWORD before executing this statement mysql> ALTER USER USER() IDENTIFIED BY ‘new_password’; Query OK, 0 rows affected (0.01 sec) mysql> SELECT 1; ±–+ | 1 | ±–+ | 1 | ±–+ 1 row in set (0.00 sec)

启动

记得启动mysql是mysqld的命令,但是不能用root使用mysqld,否则打印如下错误

2016-11-17T13:54:04.161157Z 0 [ERROR] Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root! 1 所以启动相关的命令如下

cd /usr/local/mysql

启动

support-files/mysql.server start

重启

support-files/mysql.server restart

停止

support-files/mysql.server stop

检查 MySQL 运行状态

support-files/mysql.server status

允许mysql远程访问

更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称’%’。 或者新加条记录,“host” 项为要访问的ip地址,并授权。重启mysql服务。 授权 例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。 GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTI

关注
打赏
1638062488
查看更多评论
立即登录/注册

微信扫码登录

0.0360s