Get the App
SLTechnology News&Howtos  ›  Database  › 

Installation of mysql database and problem solving

Shulou Source: shulou.com Published: 2022-06-01 06:13:03 10月25日 Update

1. Download the installation package on the official website of mysql. The official website address is www.mysql.com.

[root@seiang software] # ll

Total 580020

-rw-r--r--. 1 root root 593940480 Mar 25 18:57 mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar

2. Decompression

[root@seiang software] # tar xvf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar

Mysql-community-embedded-devel-5.7.21-1.el7.x86_64.rpm

Mysql-community-minimal-debuginfo-5.7.21-1.el7.x86_64.rpm

Mysql-community-common-5.7.21-1.el7.x86_64.rpm

Mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm

Mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm

Mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm

Mysql-community-client-5.7.21-1.el7.x86_64.rpm

Mysql-community-server-5.7.21-1.el7.x86_64.rpm

Mysql-community-embedded-5.7.21-1.el7.x86_64.rpm

Mysql-community-test-5.7.21-1.el7.x86_64.rpm

Mysql-community-devel-5.7.21-1.el7.x86_64.rpm

Mysql-community-libs-5.7.21-1.el7.x86_64.rpm

3. Install all of them with the following error

[root@seiang software] # rpm-ivh * .rpm

Warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Error: Failed dependencies:

Mariadb-libs is obsoleted by mysql-community-libs-5.7.21-1.el7.x86_64

Mariadb-libs is obsoleted by mysql-community-libs-compat-5.7.21-1.el7.x86_64

Perl (Data::Dumper) is needed by mysql-community-test-5.7.21-1.el7.x86_64

Perl (JSON) is needed by mysql-community-test-5.7.21-1.el7.x86_64

4. As the error reported above, since centos 7 defaults to mariadb database, you need to download mariadb before installing mysql

[root@seiang software] # rpm-qa | grep mariadb

Mariadb-libs-5.5.41-2.el7_0.x86_64

[root@seiang software] # rpm-e mariadb-libs-5.5.41-2.el7_0.x86_64

Error: Failed dependencies:

Libmysqlclient.so.18 () (64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

Libmysqlclient.so.18 (libmysqlclient_18) (64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

Forced unloading due to dependency

[root@seiang software] # rpm-e-- nodeps mariadb-libs-5.5.41-2.el7_0.x86_64

5. Error occurred when mysql-server was installed

[root@seiang software] # rpm-ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

Warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Error: Failed dependencies:

Mysql-community-client (x86-64) > = 5.7.9 is needed by mysql-community-server-5.7.21-1.el7.x86_64

Mysql-community-common (x86-64) = 5.7.21-1.el7 is needed by mysql-community-server-5.7.21-1.el7.x86_64

6. When prompted, install the mysql-community-common and mysql-community-client packages first

[root@seiang software] # rpm-ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm

Warning: mysql-community-common-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # # [100%]

Updating / installing...

1:mysql-community-common-5.7.21-1.e## [100%]

7. Install the mysql-client package with the following error

[root@seiang software] # rpm-ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm

Warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Error: Failed dependencies:

Mysql-community-libs (x86-64) > = 5.7.9 is needed by mysql-community-client-5.7.21-1.el7.x86_64

8. Install the mysql-community-libs package first when prompted

[root@seiang software] # rpm-ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm

Warning: mysql-community-libs-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # # [100%]

Updating / installing...

1:mysql-community-libs-5.7.21-1.el7## [100%]

9. Try to install mysql-client again

[root@seiang software] # rpm-ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm

Warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # # [100%]

Updating / installing...

1:mysql-community-client-5.7.21-1.e## [100%]

10. Finally install mysql-server

[root@seiang software] # rpm-ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

Warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # # [100%]

Updating / installing...

1:mysql-community-server-5.7.21-1.e## [100%]

11. View the services of mysql

[root@seiang software] # systemctl status mysqld.service

Mysqld.service-MySQL Server

Loaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled)

Active: inactive (dead)

Docs: man:mysqld (8)

Http://dev.mysql.com/doc/refman/en/using-systemd.html

12. Start the mysql service

[root@seiang software] # systemctl start mysqld.service

[root@seiang software] #

[root@seiang software] # systemctl status mysqld.service

Mysqld.service-MySQL Server

Loaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled)

Active: active (running) since Mon 2018-03-26 09:26:04 CST; 2s ago

Docs: man:mysqld (8)

Http://dev.mysql.com/doc/refman/en/using-systemd.html

Process: 2113 ExecStart=/usr/sbin/mysqld-daemonize-pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)

Process: 2034 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

Main PID: 2116 (mysqld)

CGroup: / system.slice/mysqld.service

2116 / usr/sbin/mysqld-daemonize-pid-file=/var/run/mysqld/mysqld.pid

Mar 26 09:25:54 seiang systemd [1]: Starting MySQL Server...

Mar 26 09:26:04 seiang systemd [1]: Started MySQL Server.

13. The mysql service starts successfully. Log in with a temporary password to view the temporary password.

[root@seiang software] # grep "password" / var/log/mysqld.log

2018-03-25T11:18:09.770923Z 1 [Note] A temporary password is generated for root@localhost: &) 2KIh?M3hr7

2018-03-25T11:19:39.853663Z 2 [Note] Access denied for user 'root'@'localhost' (using password: YES)

2018-03-25T11:22:20.996230Z 3 [Note] Access denied for user 'root'@'localhost' (using password: NO)

2018-03-25T11:24:31.219087Z 0 [Note] Shutting down plugin 'validate_password'

2018-03-25T11:24:33.062278Z 0 [Note] Shutting down plugin 'sha256_password'

2018-03-25T11:24:33.062286Z 0 [Note] Shutting down plugin 'mysql_native_password'

2018-03-26T01:25:57.938742Z 1 [Note] A temporary password is generated for root@localhost: vDepartment esf2roomojigT

Log in with a temporary password, and then change the password of root

[root@seiang software] # mysql-uroot-pv,esvf2?oj?T

Mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 2

Server version: 5.7.21

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql >

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' beijing'

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

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' qcloud@2018'

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

Both modifications prompt the same error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

The following is the official document explaining the problem:

Https://dev.mysql.com/doc/refman/5.7/en/validate-password.html

The reason for the above error: it actually has something to do with the value of validate_password_policy.

Validate_password_policy has the following values:

The default is 1, that is, MEDIUM, so the password you set at the beginning must match the length and must contain numbers, lowercase or uppercase letters, and special characters.

Solution:

Modify the value of the validate_password_policy parameter

Mysql > set global validate_password_policy=0

Query OK, 0 rows affected (0.00 sec)

Mysql > select @ @ validate_password_length

+-+

| | @ @ validate_password_length |

+-+

| | 8 |

+-+

1 row in set (0.05sec)

The default password length is 8, and an error will still occur if it is less than 8 digits.

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' beijing'

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

Modified successfully

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' qcloud@2018'

Query OK, 0 rows affected (0.00 sec)

15. Log in again with the new password and log in successfully

[root@seiang software] # mysql-uroot-pqcloud@2018

Mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 4

Server version: 5.7.21 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql >

16. Because we are used to Linux prompts, we also set prompts for mysql

(1) temporary setting

Mysql > prompt\ u @\ h\ d >

Root@ localhost (none) >

Root@ localhost (none) > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Root@ localhost mysql > prompt\ u @\ h [\ d] >

PROMPT set to'\ u@\ h [\ d] >'

Root@localhost [mysql] >

Root@localhost [mysql] >

(2) permanent setting

[root@seiang ~] # vim / etc/my.cnf

Add the following two sentences, note: [] is mysql, not mysqld

[mysql]

Prompt=\ u @\ h [\ d] >

Author: SEian.G (hard practice changes in 72, but it is difficult to laugh at 81)

Tags: Password prompt login success service again length data database method problem special same 72 change author reason parameter address uppercase uppercase letters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MySQL MariaDB Docker vpn