centos7 install mysql8.0+

Version selection
Official download URL:
https://downloads.mysql.com/archives/community/
Centos can choose the redHat version, or you can choose the general version (Linux-Generic)
because the .rpm file is used here to install, so find mysql8.0.22 Rpm package, the package name is as follows:
Insert picture description here
Third, the installation process

1. Create folders mysql and mysql-8.0.22 under mysql

cd /usr/local
mkdir mysql
cd /usr/local/mysql
mkdir mysql-8.0.22

2. Unzip the tar compressed package of rpm to the specified folder
tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql
unzip to /usr/local/mysql /mysql-8.0.22

3. After decompression is complete, check if there is mysql or mariadb on this machine.
If there is mariadb or mysql, remove it, otherwise there will be conflicts.
Check my installed MySQL
rpm -qa |grep mysql
uninstall
rpm -ev file name

4. Check my installed mariadb
rpm -qa |grep mariadb to
remove the existing mysqlb version (mysql-*)
rpm -e --nodeps mysql-community-libs-5.7.9-1.el7.x86_64

5.安装(注意安装顺序)
yum install mysql-community-common-8.0.22-1.el7.x86_64.rpm
yum install mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm
yum install mysql-community-libs-8.0.22-1.el7.x86_64.rpm
yum install mysql-community-client-8.0.22-1.el7.x86_64.rpm
yum install mysql-community-server-8.0.22-1.el7.x86_64.rpm

6. In the configuration file
vim /etc/my.cnf,
add
skip-grant-tables at the bottom, skip login verification
character_set_server=utf8 set the default character set UTF-8
init_connect='SET NAMES utf8' set the default character set UTF-8

7. Set the boot
systemctl start mysqld.service

8. Start mysql
mysql

9. Open remote connection permission
use mysql;
select host, user from user;
update user set host ='%' where user ='root';
flush privileges;

10. Modify the password (restart the mysql service when you encounter an error: systemctl restart mysqld.service)
ALTER USER'root '@'*' IDENTIFIED BY '123456';
flush privileges;
set global validate_password.policy=0;
set global validate_password.length =4;
ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

11.Open the firewall port 3306 under linux
firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl restart firewalld.service

Guess you like

Origin blog.csdn.net/Fengfgg/article/details/113753918