天天看點

CentOS7.5下yum安裝MySQL8圖文教程

解除安裝MariaDB

1.列出所有安裝的MariaDB rpm 包

rpm -qa | grep mariadb      

2.強制解除安裝

rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64      
CentOS7.5下yum安裝MySQL8圖文教程

安裝MySQL

1. 環境

CentOS7.5

2. 擷取MySQL最新版 rpm包

yum倉庫下載下傳MySQL

yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm      
CentOS7.5下yum安裝MySQL8圖文教程

3. yum安裝MySQL

yum install mysql-community-server      
CentOS7.5下yum安裝MySQL8圖文教程

4. 啟動MySQL服務

service mysqld start      
CentOS7.5下yum安裝MySQL8圖文教程

5. MySQL服務狀态

service mysqld status      
CentOS7.5下yum安裝MySQL8圖文教程

6. 檢視初始密碼

grep 'temporary password' /var/log/mysqld.log      
CentOS7.5下yum安裝MySQL8圖文教程

7. 本地MySQL用戶端登入

mysql -u root -p      
CentOS7.5下yum安裝MySQL8圖文教程

8. 修改root登入密碼

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aspirin@369';      
CentOS7.5下yum安裝MySQL8圖文教程

9 .重新整理

flush privileges;      
CentOS7.5下yum安裝MySQL8圖文教程

10. 設定開機啟動

systemctl enable mysqld.service      
CentOS7.5下yum安裝MySQL8圖文教程

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;      
CentOS7.5下yum安裝MySQL8圖文教程

12. 重新開機MySQL

systemctl restart mysqld;      
CentOS7.5下yum安裝MySQL8圖文教程

13. 開放3306端口

firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload      
CentOS7.5下yum安裝MySQL8圖文教程

繼續閱讀