创建用户
CREATE USER 用户名 IDENTIFIED BY '密码';
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%'IDENTIFIED BY '密码' WITH GRANT OPTION;
注释:
文件路径 /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 127.0.0.1 ###该句表示只允许本机访问mysql
变成这样
#bind-address = 127.0.0.1
重启mysql:/etc/init.d/mysql restart
远程链接成功,防火墙必须要开启3306端口
MariaDB 数据库
vim /etc/mysql/mariadb.conf.d/50-server.cnf
//注释掉 bind-address=127.0.0.1
//创建远程密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mm123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
//重启MariaDB
service mysql restart