Install MySQL 5.7 under CentOS 7 for middle class children!

Ready to work

We use yum to install, easy and happy!
In order to download MySQL later, we can change the default yum source of CentOS and replace it with Ali's.

# Take a look at the default yum source
cd /etc/yum.repos.d/&& ll

# Back up the original yum source
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

# Download the new CentOS-Base.repo to/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

# refresh cache
yum clean all && yum makecache

Break first and then stand

In order to install MySQL smoothly and prevent various conflicts, let's uninstall the old MySQL related (mariadb is also mysql).

View the original MySQL and MariaDB of the system

yum list installed | grep mysql
yum list installed | grep maria

My centos7 shows as follows

mariadb-libs-5.5.40-1.el7_0.x86_64

If yes, perform uninstallation

yum -y remove mariadb-libs-5.5.35-3.el7.x86_64

start installation

Add rpm source to CentOS and choose newer source

wget dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

Install the downloaded rpm file

yum install mysql-community-release-el7-5.noarch.rpm -y

After the installation is successful, two files will be added under the /etc/yum.repos.d/ folder

Modify the mysql-community.repo file

In order to install 5.7, we modify the repo file

Use yum to install mysql

yum install mysql-community-server -y

Start the service, and set the boot to start

# A temporary password needs to be generated before startup, a certificate is required, and the certificate may expire and an update operation is required
yum update -y
# Start mysql service
service mysqld start
# Set mysql to boot up
chkconfig mysqld on

Get the temporary password of mysql

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

Login with temporary password

mysql -uroot -p
# enter password

Modify root password

set global validate_password_policy=0;set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

Modify remote access permissions

grant all privileges on *.* to 'root'@'%' identified by '123456'with grant option;
flush privileges;

Set the character set to utf-8

vi /etc/my.cnf

# in[mysqld]Partially added:
character-set-server=utf8
# Add at the end of the document[client]Paragraph and in[client]Add paragraph:
default-character-set=utf8

The installation of Mysql 5.7 under CentOS 7 is successful, let's start playing!

Recommended Posts

Install MySQL 5.7 under CentOS 7 for middle class children!
Install mysql5.7 under CentOS7
Install mysql under Centos 7
Install mysql5.1 under CentOS6.5
Install MySQL under Linux (CentOS 7)
CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
CentOS install mysql
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
Install mysql8.0.13 version under Linux CentOS7 system
Install MySQL5.7 in centos7
Install mysql under Ubuntu 16.04
Install ActiveMQ under Centos7
Install PostgreSQL12 under CentOS7
Install MySQL 8.x from source code under CentOS7
Install CentOS under VMware
CentOS 7.2 Yum install MySQL 5.6
Centos7 install Mysql8 tutorial
Centos manually install mysql8
Centos7 install Mysql database
Install Jenkins under Centos 7
Install MariaDB under MariaDB Centos7
Install MySQL under Ubuntu
centos install mysql through yum
Install MySQL 8.0.16 on Linux Centos
Install Oracle11gR2 database under CentOS6.9
Install Java JDK8 under CentOS6
Centos6 install mysql 5.7.x series
Install MongoDB database under CentOS7
CentOS 6.8 under linux install mongodb
CentOS8 install MySQL8 (pro test)
Install Mesos tutorial under CentOS7
How to install MySQL on CentOS 8
CentOS7 yum install and start mysql
CentOS Yum compile and install MySQL 5.6
Compile and install LAMP under Centos 5.2
[Introduction to redis] Install redis under Centos
CentOS 7 install Nginx, PHP, MySQL packages
Install MySql with Docker in CentOS7
Install MySQL on Linux CentOS7 (Windows)
CentOS7 yum install and start mysql
Install MySQL under Ubuntu 18.04 (graphic tutorial)
Install Harbor mirror warehouse under CentOS
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos yum install mysql5.6 or above
Install Python3 and ansible under CentOS8
Install the latest OpenCV4.3 under Centos8
Install and use docker under CentOS 6.8
centos7 .*tar package to install MySQL5.7
Install Python3 and Py under CentOS7
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Tutorial diagram for installing zabbix2.4 under centos6.5
Compile and install libmodbus library under CentOS7
Installation and use of Mysql under CentOS
CentOS yum install Apache + PHP + Tomcat7 + MySQL
MySQL 8.0 installation, deployment and configuration under CentOS 6/7