1. Download MySQL Yum Repository
2. Install MySQL Yum Repository locally
sudo yum localinstall platform-and-version-specific-package-name.rpm
3. Install MySQL
sudo yum -y install mysql-community-server
4. View root initial password
sudo grep 'temporary password' /var/log/mysqld.log
5. Perform security settings
mysql_secure_installation
6. Set character set
vi /etc/my.cnf
[mysql]
default-character-set=utf8
[mysqld]
character_set_server=utf8
7. Set up startup
chkconfig --levels 235 mysqld on
8. Turn off CentOS firewall
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=3306/udp
firewall-cmd --reload
9. Create remote access user
CREATE USER 'bounter'@'%' IDENTIFIED BY '111111@Bounter';
GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'bounter'@'%';
flush privileges;
10. Start and shut down the MySQL service
sudo service mysqld start
sudo service mysqld stop
The above is the detailed content of CentOS7 installation and configuration MySQL. For more information, please follow other related articles on the PHP Chinese website!