Install Mysql8 in CentOS7 and configure remote connection and modify password, etc.

Scenes

To build a CentOS7 system using virtual machine software such as Vmware, you need to install a Mysql8 version database on it.

Note:

Blog:
Overbearing rogue temperament blog_CSDN Blog-C#, Architecture Road, Blogger in SpringBoot

accomplish

1. Go to the mysql official website to manually download the rpm package and upload it to the server, or download it directly through wget

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar

2. Create the corresponding directory and unzip it

mkdir mysql8
tar xvf mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar -C ./mysql8

3. Installation

cd mysql8
yum install -y *.rpm

If complete appears, the installation is successful

4. Start mysql and view the initial password

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

5. Change password

First log in to mysql and change the root password

mysql -uroot -p

Press Enter, and then enter the initial password queried above

Enter the statement to change the root password

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Aa_123456' password expire never;

At this time, the default password security verification level is relatively high, and a simple password cannot be set.

6. Continue to execute the sql statement, set to allow remote connection

use mysql
update user set user.Host='%'where user.User='root';
flush privileges;
quit

7. Open port 3306 of the server firewall

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

8. The test connection is successful

9. Pay attention

If you use Vmware software to build a virtual machine, in order to avoid a failed installation of Mysql8 and various problems during the installation process.

After the installation of the centos system is completed, link cloning can be performed, and msyql8 can be learned and tested on the cloned virtual machine.

In this way, if an unsolvable or unsolvable problem occurs during the process, the cloned machine can be deleted directly and a new virtual machine can be cloned again.

Guess you like

Origin blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/131807269