有外网环境下
1、安装mariadb-server, mariadb
sudo yum install MariaDB-server MariaDB-client -y
2、常用命令
# 启动MariaDB命令:
systemctl start mariadb.service
# 停止MariaDB命令:
systemctl stop mariadb.service
# 重启MariaDB命令:
systemctl restart mariadb.service```
3、设置开机自启动
systemctl enable mariadb
4、设置密码链接等设置
执行以下命令:
sudo mysql_secure_installation
以下根据提示输入:
Enter current password for root (enter for none):<–初次运行直接回车 Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车 New password: <– 设置root用户的密码 Re-enter new password: <– 再输入一次你设置的密码 Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车 Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车 Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车 Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
5、连接测试
mysql -u root -p
6、配置MariaDB允许远程连接的方法
grant all privileges on . to 'root'@'%' identified by '123456' with grant option; flush privileges;