ubuntu安装mysql添加密码

ubuntu安装mysql5.7后没有密码,添加密码。

这里是关键点,由于mysql5.7没有password字段,密码存储在authentication_string字段中,password()方法还能用

在mysql中执行下面语句修改密码

1
2
3
4
5
6
7
8
9
10
11
12
show databases;
 
use mysql;
  
update user set authentication_string=PASSWORD("自定义密码") where user='root';
  
update user set plugin="mysql_native_password";
  
flush privileges;
  
quit;
posted @ 2019-03-22 12:00  黑崎一护有头屑  阅读(609)  评论(0编辑  收藏  举报