1. Download and install mysql-server from the official website
1. Install mysql
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
2. Restart the mysql service
# service mysqld restart
3. Log in to mysql
# mysql -u root
4. Set the login password
# set password for 'root'@'localhost' =password('ryqc2016RYQC');
Second, configure mysql
1. Coding
The mysql configuration file is /etc/my.cnf
Finally add the encoding configuration
# vi /etc/my.cnf
Add at the end of the file:
[mysql]
default-character-set =utf8
2. Remote connection settings
Assign all permissions on all tables in all databases to root at all IP addresses .
mysql>grant all privileges on *.* to root@'%'identified by 'password';
If it is a new user instead of root , create a new user first
mysql> create user 'username'@'%' identified by 'password';
3. Default configuration
<!--[if !supportLists]-->1. <!--[endif]-->[client]
<!--[if !supportLists]-->2. <!--[endif]-->password = 123456
<!--[if !supportLists]-->3. <!--[endif]-->port = 3306
<!--[if !supportLists]-->4. <!--[endif]-->default-character-set=utf8
<!--[if !supportLists]-->5. <!--[endif]-->[mysqld]
<!--[if !supportLists]-->6. <!--[endif]-->port = 3306
<!--[if !supportLists]-->7. <!--[endif]-->character_set_server=utf8
<!--[if !supportLists]-->8. <!--[endif]-->character_set_client=utf8
<!--[if !supportLists]-->9. <!--[endif]-->collation-server=utf8_general_ci
<!--[if !supportLists]--> 10. <!--[endif]--> #( Note that mysql under linux is installed by default: table names are case-sensitive, column names are not case-sensitive; 0 : case sensitive, 1 : case insensitive )
<!--[if !supportLists]-->11.<!--[endif]-->lower_case_table_names=1
<!--[if !supportLists]--> 12. <!--[endif]--> #( Set the maximum number of connections, the default is 151 , the maximum number of connections allowed by the MySQL server is 16384; )
<!--[if !supportLists]-->13.<!--[endif]-->max_connections=1000
<!--[if !supportLists]-->14.<!--[endif]-->[mysql]
<!--[if !supportLists]-->15.<!--[endif]-->default-character-set = utf8
Fourth, open the firewall
1. Open the firewall
firewall-cmd --zone=public --add-port=3306/tcp --permanent
2. Restart the firewall
systemctl restart firewalld.service