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

MySQL changes the default engine and character set details

Table of contents 1. Database Engine 1.1 View dat...

PHP-HTMLhtml important knowledge points notes (must read)

1. Use frameset, frame and iframe to realize mult...

MySQL uses frm files and ibd files to restore table data

Table of contents Introduction to frm files and i...

Detailed explanation of the difference between CSS link and @import

How to add css in html? There are three ways to s...

Summary of 28 common JavaScript string methods and usage tips

Table of contents Preface 1. Get the length of a ...

Details of function nesting and closures in js

Table of contents 1. Scope 2. Function return val...

MySQL foreign key constraint disable and enable commands

Disabling and enabling MySQL foreign key constrai...

Summary of learning Docker commands in one article

Table of contents Introduction Mirror repository ...

Win2008 R2 mysql 5.5 zip format mysql installation and configuration

Win2008 R2 zip format mysql installation and conf...

JS code to achieve page switching effect

This article example shares the specific code of ...

WeChat applet calculator example

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

Example of nginx ip blacklist dynamic ban

When a website is maliciously requested, blacklis...