#
1. 下載MySQL Yum Repository
#
2. 本機安裝MySQL Yum Repository
#sudo yum localinstall platform-and-version-specific-package-name.rpm
3. 安裝MySQL
sudo yum -y install mysql-community-server
#
4. 查看root初始密碼
sudo grep 'temporary password' /var/log/mysqld.log
5. 執行安全性設定
mysql_secure_installation
#
6.設定字元集
#vi /etc/my.cnf
##[mysql]
default-character-set=utf8
[mysqld]
character_set_server=utf8
7. 設定開機啟動
chkconfig --levels 235 mysqld on
8. 關閉CentOS防火牆
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=3306/udp
firewall-cmd --reload
#
9. 建立遠端存取使用者
CREATE USER 'bounter'@'%' IDENTIFIED BY '111111@Bounter';
GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'bounter'@'%';
flush privileges;
10. 啟動與關閉MySQL服務
sudo service mysqld start
##
###sudo service mysqld stop########
以上是CentOS7安裝與設定MySQL的詳細內容。更多資訊請關注PHP中文網其他相關文章!