Linux安装MariaDB
已验证的环境:
Debian 9
Ubuntu 18.04 LTS
CentOS 8
安装
# Debian/Ubuntu
sudo apt update
sudo apt install mariadb-server
# CentOS
sudo yum update
sudo yum install mariadb-server
验证安装是否成功
# 显示Running则成功
systemctl status mariadb
配置
# 进入mysql CLI:
mysql
# 选择mysql数据库
use mysql;
# 建立用户和密码(这里帐号密码分别是root, your_password),并授权远程访问:
grant all privileges on *.* to root@'%' identified by 'your_password';
# 刷新权限,使之生效
flush privileges;
# 确认用户信息
select user,host,port from user;
# 退出CLI
exit;
下次正常连接
mysql -h127.0.0.1 -uroot -p