四、CentOS 安裝mariadb——Linux學習筆記
阿新 • • 發佈:2018-12-13
A)安裝及配置
- 下載mariadb:
yum -y install mariadb-server mariadb
- 開啟mariadb服務:
systemctl start mariadb.service
- 無密碼登入mariadb:
mysql
- 檢視使用者表:
select * from mysql.user;
- 修改密碼和授權: grant all on *.* to 'root'@'%' identified by '123456' with grant option;update mysql.user set host = '%' where user = 'root';select host, user from user;flush privileges;
- 密碼登入: mysql -u root -p
-
設定開機啟動:systemctl enable mariadb.service
B)防火牆
- 停止防火牆::systemctl stop firewalld
- 安裝iptables-services:yum install iptables-services
- 設定開機啟動:
systemctl enable iptables
systemctl stop iptables
systemctl start iptables
systemctl restart iptables
systemctl reload iptables
4.儲存設定:
service iptables save
5.開放某個埠 在/etc/sysconfig/iptables裡新增:
/sbin/iptables -A INPUT -p tcp --dport 3306 -j ACCEPT 或者
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306-j ACCEPT
參考
https://www.cnblogs.com/star91/p/4980024.html
https://blog.csdn.net/qq_40342287/article/details/82428048
http://blog.51cto.com/12173069/2119307
https://www.cnblogs.com/wujunbin/p/7465538.html
https://blog.csdn.net/c233728461/article/details/52679558/