1.安装
apt-get update
apt-get install mysql-server
2.允许远程连接
(1)vi /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉bind-address = 127.0.0.1
(2)更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从"localhost"改称"%"
update user set host = '%' where user = 'root';
3.更改密码
use mysql;
// 下一行,密码改为了yourpassword,可以设置成其他的
update mysql.user set authentication_string=password('yourpassword') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
4.重启服务
service mysql restart