Home > Database > Mysql Tutorial > Graphic tutorial for installing and configuring mysql5.7 under Centos7.3

Graphic tutorial for installing and configuring mysql5.7 under Centos7.3

黄舟
Release: 2017-09-11 11:01:14
Original
1045 people have browsed it

This article mainly introduces the installation and configuration tutorial of mysql5.7 under Centos7.3 in detail. It has certain reference value. Interested friends can refer to it.

This article shares mysql5. 7 Installation and configuration tutorial for your reference, the specific content is as follows

Step one:Get the mysql YUM source

Enter the mysql official website to get the RPM package download address


Click to download

Right click to copy the link address

https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Copy after login

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

Step 2:Download and install the mysql source

First download the mysql source installation package


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

-bash: wget: command not found

Let’s install wget first


yum -y install wget
Copy after login

Then execute


wgethttps://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Copy after login

Install mysql source


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

Step 3:Install Mysql online


yum -y install mysql-community-server
Copy after login

It will take a while to download a lot of things;

Step 4:Start the Mysql service


systemctl start mysqld
Copy after login

Step 5: Set up startup


[root@localhost ~]# systemctl enable mysqld
[root@localhost ~]# systemctl daemon-reload
Copy after login

Step 6: Modify the root local login password

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


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

Temporary password here eMV.R#mWe3ha


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

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)
Copy after login

Change the password to Caofeng2012@ (Note that the default password policy of mysql5.7 requires that the password must be a combination of uppercase and lowercase alphanumeric and special letters. At least 8 digits)

Step 7:Set up to allow remote login

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


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
Copy after login

Exit;


[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#
Copy after login

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 shown below:


[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'

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

Restart the mysql service after editing and saving;


##

[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]#
Copy after login

Check the 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)
Copy after login

Step 9:Test

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

OK Now the Mysql installation and configuration is complete;

The above is the detailed content of Graphic tutorial for installing and configuring mysql5.7 under Centos7.3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template