在CentOS7上配置MySQL5.7需要以下幾個(gè)步驟:
1. 安裝MySQL5.7
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm yum -y install mysql57-community-release-el7-9.noarch.rpm yum -y install mysql-community-server
2. 啟動(dòng)MySQL服務(wù)
systemctl start mysqld.service
3. 查看MySQL服務(wù)狀態(tài)
systemctl status mysqld.service
4. 設(shè)置MySQL服務(wù)為開機(jī)自啟動(dòng)
systemctl enable mysqld.service
5. 修改MySQL初始密碼
grep 'temporary password' /var/log/mysqld.log mysql -uroot -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
6. 配置MySQL遠(yuǎn)程訪問
mysql'GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;'mysql'FLUSH PRIVILEGES;'
7. 配置MySQL外網(wǎng)訪問
vi /etc/selinux/config#SELINUX=enforcingSELINUX=disabledsystemctl restart mysqld
完成了以上步驟,就成功地在CentOS7上配置了MySQL5.7。您可以通過MySQL的客戶端工具連接這個(gè)數(shù)據(jù)庫服務(wù)器,并進(jìn)行相應(yīng)的操作。