Installation environment: CentOS7 64-bit MINI version, install MySQL5.7 1. Configure YUM source Download the YUM source rpm installation package from the MySQL official website: http://dev.mysql.com/downloads/repo/yum/ # Download the mysql source installation package shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm # Install mysql source shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm Check whether the mysql source is installed successfully shell> yum repolist enabled | grep "mysql.*-community.*" The above picture shows that the installation is successful. You can modify the yum source to change the default installed mysql version. For example, if you want to install version 5.7, just change enabled=0 of the 5.7 source to enabled=1. The effect after the modification is as follows: vim /etc/yum.repos.d/mysql-community.repo 2. Install MySQL shell> yum install mysql-community-server 3. Start MySQL service shell> systemctl start mysqld Check the startup status of MySQL 4. Start the machine shell> systemctl enable mysqld shell> systemctl daemon-reload 5. Modify the root local login password. The root default password may be empty. 1. If the default password is empty, press Enter to log in directly There is a password. After MySQL is installed, a default password is generated for root in the /var/log/mysqld.log file. Find the root default password in the following way, and then log in to mysql to modify it: shell> grep 'temporary password' /var/log/mysqld.log shell>mysql -uroot -p mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; Or mysql> set password for 'root'@'localhost'=password('MyNewPass4!'); Note: MySQL 5.7 has a password security check plug-in (validate_password) installed by default. The default password check policy requires that the password must contain uppercase and lowercase letters, numbers, and special symbols, and the length must not be less than 8 characters. Otherwise, the error message ERROR 1819 (HY000): Your password does not satisfy the current policy requirements will be displayed, as shown in the following figure: You can view password policy information through the msyql environment variable: mysql> show variables like '%password%'; validate_password_policy: Password policy, the default is MEDIUM policy The above parameters are the password checking rules for the default policy MEDIUM. There are the following password policies: MySQL official website password policy detailed description: http://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_validate_password_policy Modify Password Policy Add validate_password_policy configuration in the /etc/my.cnf file to specify the password policy # Select one of 0 (LOW), 1 (MEDIUM), 2 (STRONG). Selecting 2 requires providing a password dictionary file validate_password_policy=0 If you do not need a password policy, add the following configuration to the my.cnf file to disable it: validate_password = off Restart the MySQL service to make the configuration take effect: systemctl restart mysqld 6. Add remote login user By default, only the root account is allowed to log in locally. If you want to connect to MySQL on other machines, you must modify root to allow remote connections, or add an account that allows remote connections. For security reasons, I add a new account: mysql> GRANT ALL PRIVILEGES ON *.* TO 'yangxin'@'%' IDENTIFIED BY 'Yangxin0917!' WITH GRANT OPTION; 7. Configure the default encoding to utf8 Modify the /etc/my.cnf configuration file and add the encoding configuration under [mysqld] as follows: [mysqld] character_set_server=utf8 init_connect='SET NAMES utf8' Restart the mysql service and check the default database encoding as follows: Default configuration file path: Uninstall mysql on Centos7 View the current installation status rpm -qa|grep -i mysql yum remove mysql rpm -e mysql-community-release-el7-5.noarch If a dependency error is prompted Then execute rpm -ev --nodeps mysql-community-libs-5.6.43-2.el7.x86_64 Delete in this way Then find the directory of the old version of mysql and delete the files and libraries of the old version of mysql. I did not delete the old library and directly did an upgrade installation. find / -name mysql Delete the corresponding mysql directory rm -rf /var/lib/mysql Note: /etc/my.cnf will not be deleted after uninstallation and needs to be deleted manually rm -rf /etc/my.cnf Sometimes my.cnf is not necessarily in /etc, you can use the command to find it find / -name my.cnf Check again whether mysql is installed on the machine rpm -qa|grep -i mysql I did not delete the original configuration files and database, but directly installed 5.7 and the original database. However, the database could not be used, so I used two commands to solve the problem. set @@global.show_compatibility_56=ON; The original database can be used normally. Summarize The above is the installation and configuration tutorial of MySQL5.7 under CentOS7 64-bit introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Analysis of centos6 method of deploying kafka project using docker
>>: Detailed explanation of Vue's monitoring method case
Recently, https has been enabled on the mobile ph...
Vue methods and properties 1. Methods Usage 1 met...
<br />Adding pictures reasonably can make a ...
In Google Chrome, after successful login, Google ...
Next, we will learn how to monitor server perform...
When shutting down the MySQL server, various prob...
A list is defined as a form of text or chart that...
Preface My needs are syntax highlighting, functio...
Three-way handshake phase Number of retries for c...
What is bubbling? There are three stages in DOM e...
Jenkins is an open source software project. It is...
Create a new configuration file (for example, go ...
The establishment of MySQL index is very importan...
This article example shares the specific code of ...
This article example shares the specific code of ...