The environment of this article is as follows:
Operating System: CentOS 6.6
MySQL version:mysql 5.7
One Installing the Software
in the Download YUM source rpm Installer in MySQL official website :http://dev.mysql.com/downloads/repo/yum/ , select Red Hat Enterprise Linux 6/oracle Linux 6 (Architecture Independent), RPM package version
download rpm software
wget "https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm"
Yum Localinstall mysql57-community-release-el6-11.noarch.rpm
Yum Repolist enabled | grep "Mysql.*-community.*"
1.1, uninstall the owner of the
#rpm-qa | grep MySQL
#rpm-E mysql-libs-5.1.73-3.el6_5.x86_64--nodeps
1.2. Configure the Yum source
in the Download YUM source rpm Installer in MySQL official website :http://dev.mysql.com/downloads/repo/yum/ , select Red Hat Enterprise Linux 6/oracle Linux 6 (Architecture Independent), RPM package version :
Click the Download button:
the No thanks,just start my download Click the right mouse button to get the link address:
Get the link address:https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
Get resources:
#wget "https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm"
1.3. Install MySQL Source
Yum Localinstall mysql57-community-release-el6-11.noarch.rpm
1.4. Check if the MySQL source is installed successfully
Yum Repolist enabled | grep "Mysql.*-community.*"
1.5.
Select the default MySQL installation version
The source provides 5.5,5.6,5.7,8.0 three versions of MySQL, the system is installed by default MySQL5.7, I want to install the 8.0 version, so change / Etc/yum.repos.d/mysql-community.repo the source configuration, change the enabled=1 of the 5.7 source to Enabled=0. And then change The enabled=0 of the 8.0 source to enabled=1.
#vi/etc/yum.repos.d/mysql-community.repo
The result of the modification is as follows:
1.6.
Installing MySQL8.0
#yum Install Mysql-community-server
1.7.
start the MySQL service
The system 7 version of the command is systemctl, but the 6 version is the service.
version 7:
#systemctl Start mysqld
Version 6:
#service mysqld Start
1.8.
to view the startup status of MySQL
version 7:
#systemctl Status Mysqld
Version 6:
#service mysqld Status
1.9.
Boot up
version 7:
Systemctl Enable Mysqld
Systemctl Daemon-reload
Version 6:
Chkconfig mysqld on
Or
Vi/etc/rc.d/rc.local
Add Content:
/etc/rc.d/init.d/mysqld start
2.0. Login Database
#mysql-uroot–p
Password does not know (5.7 above MySQL has a temporary password, and does not reset, restart Mysql will be re-give a temporary password.) )
the temporary password for the current root can be known by the following command :
# grep "Temporary password"/var/log/mysqld.log
After using the temporary password login, you need to reset the password, the command is as follows:
Mysql> set Password=password (' [email protected] ');
Appendix A:root Default Temporary password
Mysql5.7 started, added a lot of security updates, older users may have some unaccustomed.
After the 5.7.6 version, when the Mysql database is first installed and started , a temporary password is generated to the log file, as follows:
Cat/var/log/mysqld.log |grep Password
The temporary password is:; WB4A)!o1ned
Use the password to log in to the database, but can not do anything, prompted to change the password first.
Msql>show databases;
ERROR 1820 (HY000): Must reset your password using ALTER USER STATEMENT before executing this STATEMENT;
At this point, the password change will be verified, and a simple password will indicate that the rule is not met:
mysql> ALTER USER ' [email protected] ' indentified by ' 123 ';
ERROR 1819 (HY000): Your password does not statisfy the current policy requirements;
because 5.7 introduced a validtate_password plugin to verify the strength of the password.
The default values are as follows:
Mysql>show variables like ' vali% ';
The meanings are as follows:
Validate_password_check_user_name
Validate_password_dictionary_file
Validate_password_length # Minimum length of password, default is 8
Validate_password_mixed_case_count # to include at least lowercase or uppercase letters, default to 1
Validate_password_number_count # number of digits to be included at least, default = 1
Validate_password_policy # Strength level, can be set to 0,1,2. , the default here is 1
#[0/low]: check length only
#[1/medium]: Check number, case, and special characters on the basis of 0 levels
#[2/strong]:1 rank based on check special character dictionary file
Validate_password_special_char_count # The number of special characters to be included at least, default is 1.
Therefore, the initial setup password must be greater than 8 digits, contain numbers, uppercase and lowercase letters, and special characters.
Deploy MySQL in rpm mode on CentOS