Get the App
SLTechnology News&Howtos  ›  Database  › 

How Centos7.3 installs Mysql5.7 and changes the original password

Shulou Source: shulou.com Published: 2022-06-01 17:22:37 10月03日 Update

This article is mainly about Centos7.3 how to install Mysql 5.7 and change the content of the original password, if interested, take a look at this article, I believe that after reading Centos7.3 how to install Mysql 5.7 and change the original password for everyone how much reference value.

1. Official installation documentation

2. Download Mysql yum package

wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm

3. Security to software source

sudo rpm -Uvh platform-and-version-specific-package-name.rpm

rpm -Uvh mysql57-community-release-el7-10.noarch.rpm

4. Install mysql server

yum install -y mysql-community-server

5. Start MySQL

service mysqld start

systemctl start mysqld.service

6. Check the running status of mysql

service mysqld status

systemctl status mysqld.service

7. Modify temporary password

7.1 Get MySQL temporary password

You can only view temporary passwords if you have started mysql once

grep 'temporary password' /var/log/mysqld.log

The password here is YdsGaxOq>2n!

7.2 Log in and change password

mysql -uroot -p

mysql> select @@log_error;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql>

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';

First, modify the value of the validate_password_policy parameter

mysql> set global validate_password_policy=0;

set global validate_password_length=1;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';

8. Authorize other machines to log in

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;FLUSH PRIVILEGES;

9. Detailed description of password setting

http://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

http://dev.mysql.com/downloads/repo/yum/

Download locally and upload to Cloud Virtual Machine, or download directly using wget

Replace platform-and-version-specific-package-name with the rpm name you downloaded

for example

If the network environment is not very good, you can make a cup of tea or kill a game of honor after executing the order.

Mysql 5.7 is installed by default and root has a password.

In order to strengthen security, MySQL 5.7 randomly generates a password for the root user. In the error log, regarding the location of the error log, if the RPM package is installed, the default is/var/log/mysqld.log.

Log in with default password

After logging in to the server with this password, you must change the password immediately, otherwise you will report the following error:

change the password

If the password setting is too simple, the following prompt appears

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements? The solution is provided directly here and detailed instructions are provided at the end of the article.

Two global parameters must be modified:

Change the password length.

Just change the password again.

ERROR 1819 (HY000): Your password does not sa

Centos 7.3 above on how to install Mysql 5.7 and change the original password details, to help you? If you want to know more about it, you can continue to pay attention to our industry information section.

Tags: Password original service login content parameter security two value location global interest again only command security official document article scheme Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi MySQL Docker Microsoft