Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL5.7 under Centos7

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Install MySQL5.7 under Centos7

MariaDB is installed by default in CentOS, which is a branch of MySQL, but for the sake of need, MySQL is installed on the system, and MariaDB can be overwritten directly after installation.

1. Install mysql

(because there is no mysql-server on the yum source. So we have to download it from the official website. Here we use the wget command to get) wget-I-c directly.

Http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2. Install the dependency package of mysql

Yum-y install mysql57-community-release-el7-10.noarch.rpm

3. Install mysql database

Yum-y install mysql-community-server

4. Complete the installation and restart mysql

Systemctl restart mysqld

MySQL is running normally at this time, but to enter MySQL, you need to find out the password of the root user at this time. You can find the password in the log file by using the following command:

Grep "password" / var/log/mysqld.log

5. Copy and paste the password above to enter the database

Mysql-uroot-p

Enter the initial password, and you can't do anything at this time, because MySQL must change the password by default before you can operate the database password change command:

ALTER USER 'root'@'localhost' IDENTIFIED BY' 123'

6. Solve the error report

The above error report means that the newly set password is too simple and the solution:

/ / first change the complexity of the default password format

ALTER USER 'root'@'localhost' IDENTIFIED BY' Wangfeiyu@12'

7. View the complete initial password rules of MySQL

Check MySQL's complete initial password rules on the premise that you must first change the password with the ALTER USER command (SHOW VARIABLES LIKE 'validate_password%';)

Note: the length of the password is determined by validate_password_length, and the calculation formula of validate_password_length is: validate_password_length = validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)

8. Modify MySQL default policy and password length

1) modify password policy

Because the current password is too complex to do experiments later, there are two ways to use the command to modify the password policy:

Mysql > set global validate_password_policy=0

Mysql > set global validate_password_policy=LOW

Note: there are four password policies.

1. OFF (off) 2, LOW (low) 3, MEDIUM (medium) 4, STRONG (strong)

2) modify the password length

After changing the strategy above, we will change the length mysql > SET GLOBAL validate_password_length=4.

9. View password rules

Check the password rules mysql > SHOW VARIABLES LIKE 'validate_password%' after all the changes.

10. Change to a simple password

Then you can change the complex password to a simple four-digit password.

ALTER USER 'root'@'localhost' IDENTIFIED BY' 1234'

11. Uninstall the installation source automatic update

There is another problem at this time, that is, because Yum Repository is installed, every yum operation will be updated automatically. Because the current database has been installed, uninstall this:

Yum remove mysql57-community-release.noarch

12. Initialize the database

Mysql_secure_installation

Note: after executing the initialization command, you need to enter the database root user password, and then enter all the way by default as the screenshot above. (the above screenshot questions can also be selected according to your own actual situation)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 266

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report