CentOS7 install and debug Mysql database
This example requires downloading and installing and debugging the Mysql database. Step 1: download all the software required for the Mysql database installation.
I have downloaded the database software in advance and can download it directly from the server, as follows:
Download directly through scp:
[root@agt20 ~] # scp root@192.168.122.10:/root/mysql* / root/
The software is shown below:
[root@agt20 ~] # ls mysql-*
Mysql-5.7.17.tar
Mysql-community-client-5.7.17-1.el7.x86_64.rpm
Mysql-community-common-5.7.17-1.el7.x86_64.rpm
Mysql-community-devel-5.7.17-1.el7.x86_64.rpm
Mysql-community-embedded-5.7.17-1.el7.x86_64.rpm
Mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm
Mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm
Mysql-community-libs-5.7.17-1.el7.x86_64.rpm
Mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm
Mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm
Mysql-community-server-5.7.17-1.el7.x86_64.rpm
Mysql-community-test-5.7.17-1.el7.x86_64.rpm
Step 2: install through yum, start the server and view
[root@agt20 ~] # yum-y install mysql-*.rpm
[root@agt20 ~] # systemctl restart mysqld
[root@agt20 ~] # systemctl enable mysqld
[root@agt20 ~] # systemctl status mysqld.service
\ u25cf mysqld.service-MySQL Server
Loaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since\ u4e8c 2019-10-15 11:29:11 CST; 1min 15s ago
Docs: man:mysqld (8)
Http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 31584 (mysqld)
CGroup: / system.slice/mysqld.service
\ u2514\ u250031584 / usr/sbin/mysqld-daemonize-pid-file=/var/run/mysqld/mysqld.pid...
10\ u6708 15 11:28:42 agt20.tedu.cn systemd [1]: Starting MySQL Server...
10\ u6708 15 11:29:11 agt20.tedu.cn systemd [1]: Started MySQL Server.
[root@agt20 ~] #
Step 3: connect to the MySQL server and change the password
1) View the initial password
[root@agt20] # grep-I 'password' / var/log/mysqld.log
2019-10-15T03:28:55.200931Z 1 [Note] A temporary password is generated for root@localhost: r3qhDysMrM)
2) connect to the mysql service using the initial password
[root@agt20 ~] # mysql-uroot-p'r3qhDysMrM)'
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.17
Copyright (c) 2000, 2016, 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 >
3) reset the local login password of the database administrator roo
Mysql > alter user root@localhost identified by 'Pwd@123...'
Query OK, 0 rows affected (0.00 sec)
4) modify password policy
Mysql > set global validate_password_policy=0
Query OK, 0 rows affected (0.01 sec)
Mysql > set global validate_password_length=6
Query OK, 0 rows affected (0.00 sec)
Mysql > alter user root@localhost identified by 'pwd@123'
Query OK, 0 rows affected (0.00 sec)
5) Log in with the modified password
[root@agt20] # mysql-uroot-ppwd@123
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 5
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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 >
At this point, the installation and debugging of Mysql database is complete! . . . . .