Installation MySQL8
CentOS7 default database is MySQL and MariaDB does not exist yum source, so the first step is to download the source MySQL
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
I found no wget command to install wget
yum -y install wget
After a successful download in the root directory of the source
yum localinstall mysql80-community-release-el7-1.noarch.rpm
Installation Source
yum clean all
yum makecache
The source into force
yum install mysql-community-server
Install mysql, this process is relatively long
Change password
After a successful installation can not log on at reboot
You must enter a password
cat /var/log/mysqld.log | grep password
View the default password
mysql -u root -p
After logging Changing the root password
alter user root@localhost identified by 'Root_123456';
Passwords must include the case of digital special characters
flush privileges;
Refresh
exit
sign out
Create a user
External connections can not use the root user, the user needs to open separate and assign different privileges to use external
create user mysqluser@'%' identified by 'MySQL_user123';
Creating mysqluser user to specify the source address of its access% of all
grant permissions on database table names to user login name @ host
grant all privileges on *.* to mysqluser@'%' with grant option;
. : The first represents the database name; the second represents the name of the table (refer to all database tables are granted to all users, if only authorize a database or database at a particular table, put * replace the database and table to )
flush privileges;
Firewall
In this case the external connections failed data server
Because the firewall firewall Centos7 not open port 3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
--zone # scope
--add-port = 3306 / tcp # Add port, the format is: port / protocol
--permanent # permanent, this parameter does not restart after failure
systemctl restart firewalld.service
Restart the firewall
External connection is successful