Ubuntu下配置MariaDB

先确定root已设置密码;

sudo passwd root

安装mariadb-server;

sudo apt install mariadb-server

mariadb初始配置;

sudo mysql_secure_installation

修改配置文件,以允许远程连接;

sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
→#bind-address 127.0.0.1

重启mariadb-server;

systemctl restart mariadb.service

登录mariadb;

sudo mariadb -u root -p

配置远程访问用户权限;


select User, host from mysql.user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

尝试远程连接。