CentOS 7.6 installs MySQL 8.0.28

Delete Mariadb to prevent conflicts with MySQL

Check if there is mariadb

rpm -qa | grep mariadb

Forced deletion of mariadb

rpm -e --nodeps mariadb-libs

upgrade

yum -y updateoryum -y upgrade

the difference:

yum -y upgradeOnly upgrades all packages and system versions, without changing the kernel, software settings, and system settings

yum -y updateUpgrade all packages, system versions and kernels, change software settings and system settings

yum install -y unzip zip

download

mysql_8.0.28_x64 download address

Unzip on the Windows system and delete unnecessary packages; recompress and upload to the Linux server ( /root); (The remaining files are as shown below)
Keep files
(Deleted files: devel, embedded, compat, test)
Unzip

unzip mysql-8.0.28-1.el7.x86_64.rpm-bundle.zip

cd mysql-8.0.28-1.el7.x86_64.rpm-bundle

Install

Note: Packages have dependencies and must be installed in order.

rpm -ivh mysql-community-common-8.0.28-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm

Error resolution:

yum remove mysql-libs

rpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm

rpm -ivh mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm --nodeps --force

initialization

mysqld --initialize --consloe

If you encounter the following error:

mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

Solution:

yum install -y libaio.so.1

yum install -y libaio

Authorize

Authorize the mysql user mysql group

chown -R mysql:mysql /var/lib/mysql/

Start service

systemctl start mysqld

If you encounter the following error:

Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.

Solution:

rm -rf /var/lib/mysql/*

Get temporary password

cat /var/log/mysqld.log | grep root@localhost

Connect to MySQL

mysql -u root -p

Enter temporary password

change Password

alter user user() identified by '123qwe!@#';

The password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one number and one special character.

Reconnect and modify configuration

mysql -u root -p

Enter temporary password:123qwe!@#

use mysql;

select host from user where user='root';

update user set host = '%' where user ='root';

flush privileges;

Change encryption method

ALTER USER 'root'@'%' IDENTIFIED BY '123qwe!@#' PASSWORD EXPIRE NEVER;

Update user password

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123qwe!@#';

Refresh permissions

FLUSH PRIVILEGES;

- Finish-

Guess you like

Origin blog.csdn.net/qq_45594962/article/details/127051329