CentOS7 USES dnf to install mysql

  • 2020-09-28 09:16:59
  • OfStack

This paper introduces CentOS7 using dnf to install mysql, and shares the following details:

1. Install the yum warehouse for mysql

Execute the following command:


yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

2. Install mysql


dnf install mysql-community-server

3. Start mysql


service mysql start

4. Find the default password

In order to enhance security, MySQL5. 7 for root users had one randomly generated password, in error log, about error log position, if the installation is RPM package, the default is/var log/mysqld log.

Only after you have started mysql once can you view the temporary password. Enter the following command to view the password:


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

The output is as follows:

[

[root@VM_0_13_centos init.d]# grep 'temporary password' /var/log/mysqld.log
2018-03-09T13:03:32.859149Z 1 [Note] A temporary password is generated for root@localhost: IVXhn:4E3uQ4

]

5. Log in to mysql and change your password


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

Change the password and it will appear:

[

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

]

Two global parameters must be modified:

First, modify the value of the validate_password_policy parameter


set global validate_password_policy=0;

Then change the length of the password


set global validate_password_length=1;

You can change the password again


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

6. Authorize other machines to connect


GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passwort' WITH GRANT OPTION; //passwort Instead of mysql password 

FLUSH PRIVILEGES;

7. Detailed instructions for password Settings

https://www.ofstack.com/article/116032.htm
or
https://www.ofstack.com/article/95399.htm


Related articles: