mysql5.7 installation and configuration tutorial under Centos7.3

mysql5.7 installation and configuration tutorial under Centos7.3

This article shares the MySQL 5.7 installation and configuration tutorial for your reference. The specific content is as follows

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/

Click to download

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

Get this. This is the rpm package of the Yum warehouse. It is actually a download address.

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

wgethttps://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

[root@localhost ~]# systemctl enable mysqld
[root@localhost ~]# 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.

[root@localhost ~]# vi /var/log/mysqld.log

The temporary password here is eMV.R#mWe3ha

[root@localhost ~]# mysql -u root -p
Enter password:

Enter the temporary password to enter the mysql command line;

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Caofeng2012@';
Query OK, 0 rows affected (0.00 sec)

Change the password to Caofeng2012@ (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 'Caofeng2012@' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.01 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 utf8

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;

[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]#

Check out the following code:

mysql> show variables like '%character%';

+--------------------------+----------------------------+

| Variable_name | Value |

+--------------------------+----------------------------+

| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.00 sec)

Step 9: Testing

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

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

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:
  • Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux
  • How to quickly install MySQL 5.7 using YUM under Centos 7.2
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • Detailed tutorial for installing mysql5.7.18 on centos7.3
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • Linux learning third Centos7 installation mysql5.7.16 database
  • MySQL 5.7 installation and configuration tutorial under CentOS7 (YUM)
  • Detailed installation tutorial of Mysql5.7.19 under Centos7

<<:  AsyncHooks asynchronous life cycle in Node8

>>:  How to deal with the prompt "Operation not permitted" when deleting files in Linux

Recommend

docker-maven-plugin packages the image and uploads it to a private warehouse

Table of contents 1. Introduction to docker-maven...

Introduction to html form control disabled attributes readonly VS disabled

There are two ways to disable form submission in ...

The best explanation of HTTPS

Good morning everyone, I haven’t updated my artic...

Centos7 installation of MySQL8 tutorial

MySQL 8 new features: My personal opinion on MySQ...

Introduction to using Unicode characters in web pages (&#,\u, etc.)

The earliest computers could only use ASCII chara...

MySQL character set viewing and modification tutorial

1. Check the character set 1. Check the MYSQL dat...

Docker data management and network communication usage

You can install Docker and perform simple operati...

vue-router history mode server-side configuration process record

history route History mode refers to the mode of ...

Three uses and differences of MySQL not equal

Judgment symbols are often used in MySQL, and not...

How to configure CDN scheduling using Nginx_geo module

Introducing the Geo module of Nginx The geo direc...

Vue+element ui realizes anchor positioning

This article example shares the specific code of ...