Ubuntu 16.04安装Mysql5.7修改root密码

1、安装Mysql

sudo apt-get install mysql-server

sudo apt-get install mysql-client

sudo apt-get install libmysqlclient-dev

2、设置root密码

use mysql

update user set plugin='mysql_native_password' where user='root';

update user set authentication_string=password('123456') where user='root';

flush privilleges;

3、配置远程访问

注释掉在/etc/mysql/mysql.conf.d/mysqld.cnf里面的bind-address = 127.0.0.1

连接mysql数据库,修改user表

grant all on *.* to 'root'@'%' identified by '123456' with grant option;

flush privileges;

你可能感兴趣的:(Ubuntu 16.04安装Mysql5.7修改root密码)