1.安裝mariadb
yum -y install mariadb-server mariadb mariadb-devel
2.啓動mariadb
systemctl start mariadb
3.加入服務,以便能隨機器一起啓動
systemctl enable mariadb
4.加入防火牆例外,允許外部機器連接
firewall-cmd --permanent --add-service mysql
5.重啓防火牆
systemctl restart firewalld.service
5.修改root密碼
mysqladmin -uroot -pfaaa 123456
注意:這裏的faaa是隨便輸入的。因爲初始安裝mariadb的root賬戶是沒有密碼的,回車後提示你輸入密碼你直接鍵入回車就修改密碼成功了6.允許root在任何機器上登錄
a.登錄mysql
b.輸入
grant all on *.* to root@'%' identified by 'root';