1. 程式人生 > 資料庫 >centos7.4系統中yum源安裝mysql 5.6

centos7.4系統中yum源安裝mysql 5.6

系統環境:centos7.4

一,檢視是否安裝有資料庫:

yum list installed | grep mysqld/mariadb

二,安裝centos7系統帶有mysql5.6安裝包的yum源RPM資源包:

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

yum clean all

yum repolist

三,安裝msyql5.6:

yum -y install mysql-community-server

四,啟動服務:

systemctl start mysqld

systemctl enable mysqld

五,重置密碼:是具體情況而定(可以省略,無密碼登陸)

#mysql_secure_installation

Set root password? [Y/n] y              [設定root使用者密碼]

Remove anonymous users? [Y/n] y           [刪除匿名使用者]

Disallow root login remotely? [Y/n] n        [禁止root遠端登入]

Remove test database and access to it? [Y/n] y    [刪除test資料庫]

Reload privilege tables now? [Y/n] y         [重新整理許可權]

六,檢視mysql版本:

mysql -V

mysql Ver 14.14 Distrib 5.6.39,for Linux (x86_64) using EditLine wrapper

七,驗證:(無密碼)

mysql -uroot -p 密碼

八、設定密碼和遠端許可權

資料庫密碼設定:#set password for 'root'@'localhost'=password('userpasswd');

九、配置防火牆

firewall-cmd --zone=public --add-port=3306/tcp --permanent