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
Atas ialah kandungan terperinci CentOS7安装和配置MySQL. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!