Centos7 online installation and configuration MySQL5.7

1. Obtain mysql YUM source
into the RPM package mysql official website to get Download
https://dev.mysql.com/downloads/repo/yum/
address
2
copy the link address https://dev.mysql.com/get/mysql57-community-release -el7-11.noarch.rpm

2. Download source installation package mysql

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

-bash: wget: command not found
our first installation wget

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

3. Online install Mysql

yum -y install mysql-community-server

Download something slightly more so will

4. Start Mysql service

systemctl start mysqld

5. Set up boot

systemctl enable mysqld
systemctl daemon-reload
6.修改root本地登录密码

Mysql After installation is complete, /var/log/mysqld.log file to the root generate a temporary default password.

vim /var/log/mysqld.log

Here Insert Picture Description
Password here is: & <22n7t dBg &!

Then enter MySQL:

mysql -u root -p
Enter password:

Enter a temporary password to enter the mysql command line:
Here Insert Picture Description

备注 mysql5.7默认密码策略要求密码必须是大小写字母数字特殊字母的组合,至少8位.下面演示重新设置这种策略

Modifying policies (policy requirements set LOW, the length is set to claim 1)

set global validate_password_policy=0;
set global validate_password_length=1;

Then change the password:

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

Here Insert Picture Description
7. Set to allow remote login

Mysql default does not allow remote login, we need to set the next, and the firewall open port 3306;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

Here Insert Picture Description
Exit Mysql, open port 3306;

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

Note: This article from a senior, I think pretty good, for everyone to share! Under Annex blog address seniors

Li wood off

Guess you like

Origin www.cnblogs.com/cainiaoxiaoxie/p/12622241.html
Recommended