Centos7 installation and configuration of Mysql5.7

Centos7 installation and configuration of Mysql5.7

Step 1: Get the MySQL YUM source

Go to the MySQL official website to obtain the RPM package download address

https://dev.mysql.com/downloads/repo/yum/

Right click and copy the link address https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

Get the address of the rpm package

Step 2: Download and install MySQL source

First download the mysql source installation package

[root@localhost ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

-bash: wget: command not found

Let's install wget first

yum -y install wget

Then execute wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

Install mysql source

yum -y localinstall mysql57-community-release-el7-11.noarch.rpm

Step 3: Install MySQL online

yum -y install mysql-community-server

If there are a lot of downloads, please wait a little longer.

Step 4: Start the Mysql service

systemctl start mysqld

Step 5: Set up startup

systemctl enable mysqld
systemctl daemon-reload

Step 6: Change the root local login password

After mysql is installed, a temporary default password is generated for root in the /var/log/mysqld.log file.

vi /var/log/mysqld.log

The password here is: xtqh0Neteu=7

mysql -u root -p

Enter password: 

Enter the temporary password to enter the mysql command line;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'LCode1996.';

Change the password to LCode1996. (Note that the default password policy of MySQL 5.7 requires that the password must be a combination of uppercase and lowercase letters, numbers and special letters, and at least 8 characters)

Step 7: Set up remote login

Mysql does not allow remote login by default, we need to set it up and open port 3306 in the firewall;

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'LCode1996.' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql> exit;

Bye

Exit next;

[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent

success

[root@localhost ~]# firewall-cmd --reload

success

[root@localhost ~]# 

Open port 3306

Step 8: Configure the default encoding to UTF-8

Modify the /etc/my.cnf configuration file and add the encoding configuration under [mysqld] as follows:

[mysqld]

character_set_server=utf8

init_connect='SET NAMES utf8'

 

[root@localhost ~]# vi /etc/my.cnf

After editing and saving, restart the mysql service: systemctl restart mysqld

Check out the following code:

mysql> show variables like '%character%';

Step 9: Testing

We use the local sqlyog to remotely connect to the mysql in the virtual machine

At this point, the Mysql installation and configuration is complete;

You may also be interested in:
  • MySQL 5.7 installation and configuration tutorial under CentOS7 64 bit
  • Detailed steps to install MySQL on CentOS 7
  • A concise tutorial on how to install mysql5.7 decompressed version on CentOS7
  • MySQL 5.7.17 installation and configuration tutorial under CentOS6.9
  • Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux
  • How to install mysql5.6 on centos7
  • Centos7 install mysql5.6.29 shell script
  • How to install MySQL on CentOS 7 and set it to start automatically
  • The process of installing MySQL 8.0.26 on CentOS7

<<:  Implementation of socket options in Linux network programming

>>:  Example of using swiper plugin to implement carousel in Vue

Recommend

Specific usage instructions for mysql-joins

Table of contents Join syntax: 1. InnerJOIN: (Inn...

Implementation of docker-compose deployment project based on MySQL8

1. First, create the corresponding folder accordi...

How to upgrade https under Nginx

Purchase Certificate You can purchase it from Ali...

XHTML introductory tutorial: text formatting and special characters

<br />This section introduces how to impleme...

Docker enables seamless calling of shell commands between container and host

As shown below: nsenter -t 1 -m -u -n -i sh -c &q...

Linux Operation and Maintenance Basic System Disk Management Tutorial

1. Disk partition: 2. fdisk partition If the disk...

Implementation steps for docker-compose to deploy etcd cluster

Table of contents Write docker-compose.yml Run do...

How to configure two-way certificate verification on nginx proxy server

Generate a certificate chain Use the script to ge...

Detailed explanation of the process of docker packaging Python environment

The steps of docker packaging Python environment ...

js implements table drag options

This article example shares the specific code of ...

MySql Group By implements grouping of multiple fields

In daily development tasks, we often use MYSQL...

Hidden overhead of Unix/Linux forks

Table of contents 1. The origin of fork 2. Early ...

How to add shortcut commands in Xshell

As a useful terminal emulator, Xshell is often us...

Tips to prevent others from saving as my web page and copying my site

Nowadays, copying websites is very common on the I...

display:grid in CSS3, an introduction to grid layout

1. Grid layout (grid): It divides the web page in...