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

In-depth understanding of Mysql logical architecture

MySQL is now the database used by most companies ...

Summarize how to optimize Nginx performance under high concurrency

Table of contents Features Advantages Installatio...

5 VueUse libraries that can speed up development (summary)

Table of contents What utilities does VueUse have...

Detailed explanation of MySQL combined query

Using UNION Most SQL queries consist of a single ...

Vue implements the right slide-out layer animation

This article example shares the specific code of ...

Example of using rem to replace px in vue project

Table of contents tool Install the plugin Add a ....

Web Design: Script Materials Reconstruct User Experience

<br />Original text: http://blog.rexsong.com...

Essential bonus items for optimizing and packaging the front end of Vue projects

Table of contents Preface 1. Routing lazy loading...

Detailed explanation of Truncate usage in MYSQL

This article guide: There are two ways to delete ...

JavaScript Closures Explained

Table of contents 1. What is a closure? 1.2 Memoi...

Drop-down menu and sliding menu design examples

I found a lot of websites that use drop-down or sl...

3D tunnel effect implemented by CSS3

The effect achievedImplementation Code html <d...

Solve the problem of case sensitivity of Linux+Apache server URL

I encountered a problem today. When entering the ...