Mysql开启远程连接
旧版
vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;
/etc/init.d/mysql restart
修改密码:mysql> set password for root@localhost = password('123');
新版
默认装完不需要密码,如需要,查看cat /etc/mysql/debian.cnf
默认密码
use mysql;
update user set authentication_string='' where user='root';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH privileges;
重启服务:systemctl restart mysql.service