STEP1: Check whether the system comes with the installation of MySQL
# Yum List Installed | grep MySQL
STEP2: Delete the system's own MySQL and its dependencies
Command:
# yum-y Remove mysql-libs.x86_64
STEP3: Add a RPM source to CentOS and select a newer source
Command:
# wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
# yum Localinstall mysql-community-release-el6-5.noarch.rpm
# Yum Repolist All | grep MySQL
# Yum-config-manager--disable mysql55-community
# Yum-config-manager--disable mysql56-community
# Yum-config-manager--enable MYSQL57-COMMUNITY-DMR
# Yum Repolist enabled | grep MySQL
Note This time you may find that the host is not yum-config-manager this thing, at this time
This is because the system does not install this command by default, this command in the Yum-utils package, can be installed by the command yum-y install Yum-utils.
STEP4: Installing the MySQL server
Command:
# yum Install Mysql-community-server
STEP5: Start MySQL
Command:
# service Mysqld Start
STEP6: Check if MySQL is self-booting and set on self-boot
Command:
# chkconfig--list | grep mysqld
# Chkconfig Mysqld on
To view the root password:
# grep "Password"/var/log/mysqld.log2016-08-10t15:03:02.210317z 1 [Note] A temporary password is generated for [email pro Tected]: Ayb (&-3CZ-RW
Now you must change your password immediately, or you will get an error:
ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.
Change the password (if you error error 1819 in this step, please scroll down to see why and how to fix it):
mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');
6. Check if the mysqld is powered on and set to boot from:
1 Chkconfig--list | grep mysqld2 chkconfig mysqld on
7. Modify the character set to UTF-8:
Vim/etc/my.cnf
In the [Mysqld] section, add:
Character-set-server=utf8
Add the [client] segment at the end of the file and in the [client] segment:
Default-character-set=utf8
Restart the MYSQLD service after you have modified it:
Service mysqld Restart
To view the results of the modification:
Mysql> Show variables like "%character%", +--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+| character_set_client | UTF8 | | character_set_connection | UTF8 | | character_set_database | UTF8 | | character_set_filesystem | binary | | character_set_results | UTF8 | | Character_set_server | UTF8 | | character_set_system | UTF8 | | character_sets_dir |/usr/ share/mysql/charsets/|+--------------------------+----------------------------+8 rows in Set (0.00 sec)
Note: In the change password step, if the password set is a simple password, the following error may occur:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
This error is actually related to the setting of the Validate_password_policy value:
The Validate_password_policy value defaults to 1, which is medium, so the password you just started must meet the length requirements and must contain numbers, lowercase or uppercase letters, special characters
If we're just doing tests instead of requiring such a complex password, you can modify the Validate_password_policy value using the following method
mysql> set global validate_password_policy=0; Query OK, 0 rows Affected (0.00 sec)
In this way, the password requirement is only the length, and the minimum length of the password is determined by the Validate_password_length value
The Validate_password_length parameter defaults to 8, and it has the minimum limit, and the minimum value is:
validate_password_number_count+ validate_password_special_char_count+ (2 * validate_password_mixed_case_count)
Where validate_password_number_count specifies the length of the number in the password, validate_password_special_char_count specifies the length of the special characters in the password, Validate_ PASSWORD_MIXED_CASE_COUNT Specifies the length of the size letter in the password. The default value for these parameters is 1, so the Validate_password_length minimum value is 4, if the value of the dominant specified validate_password_length is less than 4, although no error is given, Validate_password_ The value of length will be set to 4
Set the value of the Validate_password_length:
mysql> set global validate_password_length=4; Query OK, 0 rows Affected (0.00 sec)
If you modify the Validate_password_number_count,validate_password_special_char_count,validate_password_mixed_case_ Any value in count, Validate_password_length is dynamically modified.
CentOS 6.5 installation MySQL 5.7.21 community