Detailed steps for installing and debugging MySQL database on CentOS7 [Example]

Detailed steps for installing and debugging MySQL database on CentOS7 [Example]

This example requires downloading and installing the debugging MySQL database.

Step 1: Download all the software required to install the MySQL database.

I have downloaded the database software in advance, and I can download it directly on the server, as follows:

Download directly via scp:

[root@agt20 ~]# scp [email protected]:/root/mysql* /root/

The software is as follows:

[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 
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 MySQL server and change 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) Use the initial password to connect to the MySQL service

[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 using the changed 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 the Mysql database is completed! ! ! !

Summarize

The above is the detailed steps of installing and debugging MySQL database on CentOS7 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Tutorial on installing mysql under centos7
  • CentOS7 uses yum to install mysql 8.0.12
  • Detailed tutorial on installing MySQL 8.0 from source code on CentOS 7.4
  • Installation tutorial of mysql8.0rpm on centos7
  • Tutorial on installing lnmp using yum on centos7 (linux+nginx+php7.1+mysql5.7)
  • Centos7 installation and configuration of Mysql5.7

<<:  Summary of MySQL time statistics methods

>>:  vue-router history mode server-side configuration process record

Recommend

Simple example of using Docker container

Table of contents 1. Pull the image 2. Run the im...

CSS to implement QQ browser functions

Code Knowledge Points 1. Combine fullpage.js to a...

Simplify complex website navigation

<br />Navigation design is one of the main t...

Several solutions for forgetting the MySQL password

Solution 1 Completely uninstall and delete all da...

Xftp download and installation tutorial (graphic tutorial)

If you want to transfer files between Windows and...

Html and CSS Basics (Must Read)

(1) HTML: HyperText Markup Language, which mainly...

How to implement horizontal bar chart with percentage in echarts

Table of contents Example Code Rendering Code Ana...

Two ideas for implementing database horizontal segmentation

introduction With the widespread popularity of In...

Detailed explanation of the execution process of MySQL query statements

Table of contents 1. Communication method between...

Detailed explanation of Linux file operation knowledge points

Related system calls for file operations create i...