How to manually install MySQL 5.7 on CentOS 7.4

How to manually install MySQL 5.7 on CentOS 7.4

MySQL database is widely used, especially for JAVA programmers. If you do not want to purchase a cloud database, you can install the MySQL database yourself. This article will introduce how to manually install MySQL version 5.7 in the CentOS 7.4 environment.

1. Install MySQL version: 5.7.25

2. Download address

https://dev.mysql.com/downloads/mysql/5.7.html#downloads

(As time goes by, please refer to the latest download address)

3. Use the wget command to download the relevant rpm files using the breakpoint transmission method

(If the address is updated, please refer to the latest one)

https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.25-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-libs-5.7.25-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-devel-5.7.25-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.25-1.el7.x86_64.rpm
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.25-1.el7.x86_64.rpm

4. After downloading, enter the corresponding directory and install it one by one

(Note: There is a sequence for installation, just install it according to the download order above)

rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm --force --nodeps

(Note: --force --nodeps should be added appropriately according to the situation. Otherwise, some machines will experience installation errors.)

5. After the installation is complete, you first need to start the service.

(Note that the service startup of CentOS7 and above is different from 6)

systemctl start mysqld

6. Confirm that the installation is successful and create the initial root administrator password

Modify /etc/my.cnf

vi /etc/my.cnf

Add in [mysqld]

skip-grant-tables=1

This line of configuration tells mysqld not to verify the password when it starts

7. Restart mysqld service

systemctl restart mysqld

8. Change the root login password

1) Log in to MySQL as root user

mysql -uroot -p (press Enter directly, the password is empty)

2) Switch database

use mysql;

3) Update the user table

update user set authentication_string = password('your password'), password_expired = 'N', password_last_changed = now() where user = 'root';

9. After the password is changed successfully, you can log in to MySQL and set up the client connection.

(Note: If not set, the client Navicat cannot connect)

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

Refresh table data

flush privileges;

quit

\q

10. Edit the /etc/my.cnf file and delete the content of skip-grant-tables=1

vi /etc/my.cnf

11. Set the MySQL encoding to prevent garbled characters. Under [mysqld], add the encoding method

character-set-server=utf8

(For details, please see the attached document)

12. Restart MySQL service

systemctl restart mysqld

Once you can connect to the database through client software, such as Navicat for MySQL, congratulations, the installation is successful.

【FAQ】

1. When installing under CentOS on a server in Hong Kong, the service cannot be started.

[root@syne-hk-test mysql-5.7]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

After in-depth investigation, the reason is that libaio.so.1 is not installed, so just install it.

yum install libaio

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • Centos7 installation and configuration of Mysql5.7
  • A concise tutorial on how to install mysql5.7 decompressed version on CentOS7
  • Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux
  • How to install MySQL 5.7 from source code in CentOS 7 environment
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • Detailed installation tutorial of Mysql5.7.19 under Centos7
  • How to quickly install MySQL 5.7 using YUM under Centos 7.2
  • MySQL 5.7 installation and configuration tutorial under CentOS7 (YUM)
  • Centos7.5 installs mysql5.7.24 binary package deployment
  • centos7.2 offline installation mysql5.7.18.tar.gz

<<:  Solve the problem of running node process in Linux system but unable to kill the process

>>:  Summary of Linux date command knowledge points

Recommend

A Deep Understanding of Angle Brackets in Bash (For Beginners)

Preface Bash has many important built-in commands...

HTML&CSS&JS compatibility tree (IE, Firefox, Chrome)

What is a tree in web design? Simply put, clicking...

Detailed explanation of Mysql's concurrent parameter adjustment

Table of contents Query cache optimization Overvi...

Detailed explanation of the watch listener example in vue3.0

Table of contents Preface The difference between ...

Web Design: When the Title Cannot Be Displayed Completely

<br />I just saw the newly revamped ChinaUI....

TypeScript union types, intersection types and type guards

Table of contents 1. Union Type 2. Crossover Type...

In-depth understanding of MySQL master-slave replication thread state transition

Preface The basic principle of MySQL master-slave...

Web page printing thin line table + page printing ultimate strategy

When I was printing for a client recently, he aske...

Use jQuery to fix the invalid page anchor point problem under iframe

The application scenario is: the iframe page has n...