Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL5.7 manually by CentOS7.4

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to manually install MySQL5.7 in CentOS7.4. I hope you will get something after reading this article. Let's discuss it together.

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 install the MySQL5.7 version manually in the CentOS7.4 environment.

1. Install MySQL version: 5.7.25

2. Download address

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

(with the passage of time, please refer to the latest download address)

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

(if the address is updated, please keep it up-to-date.)

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 the download is completed, go to the corresponding directory and install it in turn

(note: there is a sequence of installation, so you can install it according to the download order above)

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

(note: where-- force-- nodeps should be added appropriately according to the situation. Otherwise, some machines will be abnormal in installation)

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

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

Systemctl start mysqld

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

Modify / etc/my.cnf

Vi / etc/my.cnf

Add in [mysqld]

Skip-grant-tables=1

This line is configured so that the password is not verified when mysqld starts

7. Restart the mysqld service

Systemctl restart mysqld

8. Change the login password of root

1) Log in to mysql using the root user

Mysql-uroot-p (click enter directly, the password is empty)

2) switch databases

Use mysql

3) Update the user table

Update user set authentication_string = password ('your password'), password_expired = 'password', password_last_changed = now () where user = 'root'

9. After the password is successfully modified, 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 / etc/my.cnf file and delete the contents of skip-grant-tables=1

Vi / etc/my.cnf

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

Character-set-server=utf8

(see attached document for details)

12. Restart MySQL service

Systemctl restart mysqld

After you can connect to the database through client software, such as Navicat for MySQL, congratulations on your successful installation.

[FAQ]

1. The service cannot be started when it is installed under the server CentOS in Hong Kong.

[root@syne-hk-test mysql-5.7] # systemctl start mysqldJob 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, it can be installed.

Yum install libaio finished reading this article, I believe you have a certain understanding of "how to manually install MySQL5.7 in CentOS7.4". If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report