ubuntu18.04安装mysql不会弹出设置账号密码的框,会自己默认设置好账号密码,
配置文件在/etc/mysql/debian.cnf

使用此账号密码登陆mysql,然后再建立root账户

命令为:mysql -u xxx -p
在控制台下输入:
mysql> update mysql.user set authentication_string=password("root") where user="root";
此时会有警告,使用下面的命令消除禁告
mysql>update mysql.user set plugin="mysql_native_password";
最后更新权限
mysql>flush privileges;

退出,重启mysql即可

网友评论