rkey

rkey

Installing MySQL 8.0.28 on CentOS

Download and extract

mysql-community-client-8.0.28-1.el7.x86_64
mysql-community-client-plugins-8.0.28-1.el7.x86_64
mysql-community-common-8.0.28-1.el7.x86_64
mysql-community-devel-8.0.28-1.el7.x86_64
mysql-community-embedded-compat-8.0.28-1.el7.x86_64
mysql-community-icu-data-files-8.0.28-1.el7.x86_64
mysql-community-libs-8.0.28-1.el7.x86_64
mysql-community-libs-compat-8.0.28-1.el7.x86_64
mysql-community-server-8.0.28-1.el7.x86_64
mysql-community-test-8.0.28-1.el7.x86_64

I have downloaded it. Here is a download link from Chengtong Cloud Disk:

https://url10.ctfile.com/d/25666910-50740516-e8e9ca?p=4232

(Access password: 4232)

Then create a folder elsewhere and put these items inside

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

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

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

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

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

mysql-community-server-8.0.28-1.el7.x86_64.rpm

Then transfer it to the Linux system at /usr/local/mysqls. If there is no mysql folder, create one yourself.

Then check the dependencies required by mysql

rpm -qa|grep libaio

If there is no output, it means it is not installed, and you need to execute the download:

yum -y install libaio

Then check net-tools

rpm -qa|grep net-tools

If there is no output, it means it is not installed, and you need to execute the download:

yum -y install net-tools

After successful transfer, execute in the following order. Do not get the order wrong, or errors may occur.

(It is best to find a txt file to copy the following code into, replace my file names with your file names, and then copy it to the Linux system to execute line by line.)

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
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

If there is an installation error, you can add --nodeps --force after the rpm command that reported the error. For example, if the second installation reported an error,

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

Then add --nodeps --force and execute again

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

Authorize the installation path

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

Initialize mysql

mysqld --initialize

Authorize

chmod -R 777 /var/lib/mysql/auto.cnf
chown mysql:mysql /var/lib/mysql -R

Start the mysql service

systemctl start mysqld.service

Check the mysql status

systemctl status mysqld.service

View the initial mysql password

cat /var/log/mysqld.log | grep password

Log in to mysql

mysql -u root -p

Change the mysql password

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

Thus, mysql installation is complete.

(If there are errors during the installation process, try executing the authorization code again.)

If you cannot change the password

Check the current settings

show variables like 'validate_password%';

Change the password length

set global validate_password.length=6;

Change the password level

set global validate_password.policy=LOW;

Set check_name

set global validate_password.check_user_name=OFF;

Change the password again

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

Set remote access

create user 'root'@'%' identified with mysql_native_password by '123456';

Grant all privileges to root

grant all privileges on *.* to 'root'@'%' with grant option;

Flush privileges

flush privileges;

Open port 3306 in the Linux system firewall

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

Restart the firewall to make the open port effective

sudo firewall-cmd --reload

Change the mysql port

vi /etc/my.conf

Add the port under [mysqld]. If there is a port, modify the port number after port; if not, directly add port=your desired port number.

[mysqld]
port=port_number

(The default mysql port number is 3306)

Open the port in the Linux system firewall

(If your service cannot access mysql, go to the cloud service provider's management platform to allow that port. The open port in the cloud service provider is generally called a security group.

Yes, you read that right, your services on the server are accessed this way:

Cloud service provider's control layer - your server control layer - services on your server.)

sudo firewall-cmd --zone=public --add-port=port_number/tcp --permanent

Query the installed mysql

 yum list installed | grep mysql

Uninstall mysql

yum -y remove mysql-community-client.x86_64
yum -y remove mysql-community-client-plugins.x86_64
yum -y remove mysql-community-common.x86_64
yum -y remove mysql-community-icu-data-files.x86_64
yum -y remove mysql-community-libs.x86_64
yum -y remove mysql-community-server.x86_64

References

https://blog.csdn.net/weixin_53132064/article/details/126188742

https://blog.csdn.net/weixin_53132064/article/details/126188742

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.