Software as Environment Preparation
1. Prepare a Linux server
Either cloud server or virtual machine is fine; (The following download is a virtual machine under Windows11)
The version of Linux is CentOS7;
Download ISO image file address:
https://repo.huaweicloud.com/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-DVD-2207-02.iso
Download operating environment: VMware8.0
Please contact QQ: 1742756263—–virtual machine installation tutorial/packaging software/Sinicization/serial number because it cannot be uploaded
2. Download MySQL installation package for Linux
MySQL 8.0.26 download address:
https://downloads.mysql.com/archives/community/
3. Download terminal software running Linux—FinalShell
Download address: direct download from computer software store
4. FinalShell connects to Linux
-
Name: xxx (preferably in English)
-
Host: find IP address copy on Linux server
-
Port: 22 by default
-
method:password
-
Username: root
-
Password: the password set by Linux
Install and run MySQL
5. Upload MySQL installation package
6. Create a directory and unzip
mkdir mysql tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar -C mysql
7. Install mysql installation package
cd mysql rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-compat-8.0.26-1.el7.x86_64.rpm yum install openssl-devel rpm -ivh mysql-community-devel-8.0.26-1.el7.x86_64.rpm rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
Note: The installation of the third code depends on the error report
Solution
-
Check if the mariadb-libs package is installed
rpm -q mariadb-libs
PS: Because Linux comes with the mariadb database, the MYSQL installation fails
-
Uninstall postfix first
yum remove postfix
-
Then uninstall mariadb-libs
yum remove mariadb-libs
4. Complete the download so the dependent files
8. Start MySQL service
systemctl start mysqld systemctl restart mysqld systemctl stop mysqld
9. Query the automatically generated root user password
grep 'temporary password' /var/log/mysqld.log
Command line execution command:
mysql -u root -p
Then enter the automatically generated password from the above query to complete the login.
10. Modify root user password
After logging in to MySQL, you need to change the automatically generated password that is inconvenient to remember, and change it to a password that you are familiar with and easy to remember.
ALTER USER 'root'@'localhost' IDENTIFIED BY '1234';
An error will be reported when executing the above SQL, because the set password is too simple and the password complexity is not enough. We can set the complexity of the password to simple type, and the password length to 4.
set global validate_password.policy = 0; set global validate_password. length = 4;
After lowering the verification rules of the password, execute the above command to modify the password again.
11. Create user
The default root user can only access the localhost of the current node, and cannot access remotely. We also need to create a root account for the user to access remotely
create user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '1234';
12. And assign permissions to the root user
grant all on *.* to 'root'@'%';
13. Reconnect to MySQL
mysql -u root -p
14. Connect to MySQL remotely through DataGrip
Set as follows: (Host is LinuxIP address)
Note: The cause of the detection connection failure
-
Linux firewall interception
2. Turn off the firewall with the FinalShell command
Turn off the firewall systemctl stop firewalld.service Turn on the firewall systemctl start firewalld.service