I. Installation and configuration of MySQL
Download the Yum source RPM installation package on the MySQL website: http://dev.mysql.com/downloads/repo/yum/
Download the MySQL installation package
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Installing the source of MySQL
Yum localinstall mysql57-community-release-el7-8.noarch.rpm
Detect if the installation was successful
| grep "mysql.*-community.*"
You can modify vim /etc/yum.repos.d/mysql-community.repo
the source to change the MySQL version of the default installation. For example, to install version 5.6, the 5.7 source of the enabled=1 changed to Enabled=0. Then change the 5.6 source enabled=0 to Enabled=1. The effect after the change is as follows
Install MySQL
Yum Install Mysql-community-server
Start the service
Systemctl Start mysqld
查看启动状态
Systemctl Status Mysqld
设置开机启动
systemctl enable Mysqldsystemctl daemon-reload
修改root本地的密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
' Temporary password ' /var/log/mysqld.log
; HQS745AQUCF is the auto-generated temporary password
Log in to MySQL, enter the default password
Mysql-uroot-p
修改root密码
' Root '@'localhost ' new password '
Note: MySQL has the password security check-in (Validate_password) installed by default, and the default password-checking policy requires that the password must contain: uppercase and lowercase letters, numbers, and special symbols, and not less than 8 bits in length. Otherwise you will be prompted for error 1819 (HY000): Your password does not satisfy the current policy requirements error, you can view information about the password policy through the MSYQL environment variable
' %password% ';
Validate_password_policy: Password policy, default to Medium policy
Validate_password_dictionary_file: Password policy file, policy for strong only required
Validate_password_length: Minimum Password length
Validate_password_mixed_case_count: Uppercase and lowercase character length, at least 1
Validate_password_number_count: Number of at least 1
Validate_password_special_char_count: Minimum of 1 special characters
The above parameter is the password check rule for the default policy medium.
Add Telnet user
默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户
' ro '@'%'lostgood.123' with GRANT OPTION;
Configure default encoding to UTF8
Modify the/ETC/MY.CNF configuration file and add the encoding configuration under [Mysqld] as follows:
[Mysqld]character_set_server=utf8init_connect='set NAMES UTF8'
Restart the MySQL service to view the database default encoding as follows:
' %character% '
CentOS 7 MYSQL