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 mysql 5.7on CentOS 7 system

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

Share

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

In this issue, the editor will bring you about how to install mysql 5.7. the article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

1. Download and install MySQL's official Yum Repository

Wget-I-c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

A rpm file is generated in the current directory

2. Install using yum

Yum-y install mysql57-community-release-el7-10.noarch.rpmyum-y install mysql-community- server [/ code]

Wait a while before the MySQL installation is complete, followed by some settings for MySQL.

3. Modify the root password

After successful installation, a root user is created by default with an initial password. You need to change the initial password and start mysql.

Systemctl start mysqld.service

Find the initial password in the Mysql log with the following command

Grep "password" / var/log/mysqld.log

Enter the database with the following command

Mysql-uroot-p

Execute the password change command in the mysql client connection environment

ALTER USER 'root'@'localhost' IDENTIFIED BY' new@password'

The password has been changed successfully. Restart the mysql service.

Systemctl restart mysqld.service

4. Modify the character set to UTF-8

Enter Mysql with the command mysql-uroot-p, note the new password, and view the character set in the mysql environment with the following command

Show variables like'% character%'

We see that not all the above character sets are utf-8. Now we open the mysql configuration file in the bash terminal.

Vi / etc/my.cnf

Add the following configuration items according to the actual situation

# add by tangxiaobaicharacter-set-server=utf8 [client] default-character-set=utf8 [mysql] default-character-set=utf8

Restart the server to see if the character set has been modified successfully

We see that the character set has been modified successfully

5. Set mysql to support remote connection

Up to now, our Mysql cannot be accessed remotely. Here we use this table method. Log in to the mysql command client and execute the following command

Use mysql;update user set host ='% 'where user =' root'

Restart the Mysql service and test with the client connection tool

We see that the mysql connection test is successful.

However, there is another problem at this time, that is, because Yum Repository is installed, every yum operation will be automatically updated later, and this needs to be uninstalled:

Yum-y remove mysql57-community-release-el7-10.noarch above is the editor for you to share how to install mysql 5.7 in the CentOS 7 system, if you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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