Get the App
SLTechnology News&Howtos  ›  Database  › 

How to install mysql 5.7on CentOS 7 system

Shulou Source: shulou.com Published: 2022-05-31 23:15:28 09月13日 Update

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.

Tags: Commands passwords success characters character sets customers clients services systems Zhongan content that is files environment facets analysis testing configuration professional small and medium-sized Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux vpn Shulou Information Microsoft