Installation tutorial of mysql 5.7 under CentOS 7

Installation tutorial of mysql 5.7 under CentOS 7

1. Download and install the official MySQL Yum Repository

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

The rpm file will be generated in the current directory

2. Install using yum

yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

After waiting for a while, MySQL will be installed, followed by some settings for MySQL.

3. Change the root password

After successful installation, a root user will be 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. The command is as follows

grep "password" /var/log/mysqld.log

Enter the database using the following command

mysql -uroot -p

Execute the change password command in the mysql client connection environment

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

At this point the password has been changed successfully, restart the mysql service

systemctl restart mysqld.service

4. Change the character set to UTF-8

Enter MySQL through the command mysql -uroot -p. Note that it is a new password. In the MySQL environment, use the following command to view the character set.

show variables like '%character%';

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

vi /etc/my.cnf

Add the following configuration items according to actual situation

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

Restart the server and check whether the character set has been modified successfully.

We see that the character set has been modified successfully

5. Set up MySQL to support remote connection

So far, our Mysql cannot be accessed remotely. Here we use the 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 it with the client connection tool

We see that the mysql connection test is successful.

But there is still a problem at this time, that is, because the Yum Repository is installed, each subsequent yum operation will automatically update, so you need to uninstall it:

yum -y remove mysql57-community-release-el7-10.noarch

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:
  • Installation of mysql-community-server. 5.7.18-1.el6 under centos 6.5
  • Detailed tutorial on installing MySQL 5.7.6+ from source in CentOS 7
  • Deploy MySQL 5.7.17 binary installation and multi-instance configuration on CentOS 6.5
  • Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5
  • Detailed tutorial on installing MySQL 5.7.18 under CentOS 6.5
  • Centos6.5 compile and install mysql 5.7.14 detailed tutorial
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • Detailed instructions for compiling and installing CentOS MySQL 5.7
  • MySQL 5.7.17 installation and configuration tutorial under CentOS6.9
  • Detailed installation tutorial of mysql 5.7 under CentOS 6 and 7

<<:  React tips teach you how to get rid of hooks dependency troubles

>>:  Complete steps for Nginx to configure anti-hotlinking

Recommend

Quick understanding and example application of Vuex state machine

Table of contents 1. Quick understanding of conce...

Why does your height:100% not work?

Why doesn't your height:100% work? This knowl...

Execute the shell or program inside the Docker container on the host

In order to avoid repeatedly entering the Docker ...

Common problems and solutions during MySQL MGR construction

Table of contents 01 Common Faults 1 02 Common Fa...

Use HTML to write a simple email template

Today, I want to write about a "low-tech&quo...

CenterOS7 installation and configuration environment jdk1.8 tutorial

1. Uninstall the JDK that comes with centeros fir...

Serial and parallel operations in JavaScript

Table of contents 1. Introduction 2. es5 method 3...

Implementation of Docker deployment of Tomcat and Web applications

1. Download docker online yum install -y epel-rel...

HTML table markup tutorial (48): CSS modified table

<br />Now let's take a look at how to cl...

How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

Xrdp is an open source implementation of Microsof...

jQuery plugin to achieve image suspension

This article shares the specific code of the jQue...

MySQL index pushdown details

Table of contents 1. Leftmost prefix principle 2....

Detailed tutorial on installing and using Kong API Gateway with Docker

1 Introduction Kong is not a simple product. The ...