解除安裝MariaDB
1.列出所有安裝的MariaDB rpm 包
rpm -qa | grep mariadb
2.強制解除安裝
rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
安裝MySQL
1. 環境
CentOS7.5
2. 擷取MySQL最新版 rpm包
yum倉庫下載下傳MySQL
yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
3. yum安裝MySQL
yum install mysql-community-server
4. 啟動MySQL服務
service mysqld start
5. MySQL服務狀态
service mysqld status
6. 檢視初始密碼
grep 'temporary password' /var/log/mysqld.log
7. 本地MySQL用戶端登入
mysql -u root -p
8. 修改root登入密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aspirin@369';
9 .重新整理
flush privileges;
10. 設定開機啟動
systemctl enable mysqld.service
11. 遠端連接配接授權
use mysql;
select user,host from user;
update user set host = '%' where user = 'root'; #任意ip都可以連
update user set host='your ip' where user='root'; //指定ip
flush privileges;
12. 重新開機MySQL
systemctl restart mysqld;
13. 開放3306端口
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload