This article has participated in the activity of “New person creation Ceremony”, and started the road of digging gold creation together.
Step 1: Download the source file from the official website:
Dev.mysql.com/downloads/r…
Step 2: Save the source file to the home folder in Centos
Then type the command:
yum localinstall mysql80-community-release-el7-1.noarch.rpm
Copy the code
Run the following command to check whether the installation is successful:
yum repolist enabled | grep "mysql.*-community.*"
Copy the code
The following figure shows that the installation is successful
Step 3: Enter the following command to install mysql
yum install mysql-community-server
Copy the code
Step 4: Start the mysql service
service mysqld start
Copy the code
Check whether the startup is successful :(as shown in the following figure)
service mysqld status
Copy the code
Step 5: Log in and change the password
-
Find the default password
grep 'temporary password' /var/log/mysqld.log Copy the code
-
Log in and enter the password found in the previous command
mysql -uroot -p Copy the code
-
Change password:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Test@1234'; Copy the code
Step 6 view and modify the information about the password policy
show variables like '%password%';
Copy the code
-
Example Modify a password policy
set global validate_password.check_user_name=OFF; set global validate_password.policy=0; set global validate_password.length=3; Copy the code
- After the modification, exit MySQL and restart MySQL service
Step 7: Change simple passwords
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
Copy the code
Step 8: Change the maximum number of connections
set persist max_connections=1000;
show variables like 'max_connections';
Copy the code
Step 9: Add a remote login user
-
Modify the host
update user set host='%' where user ='root'; Copy the code
-
Set to take effect
flush privileges; Copy the code
-
Open ports
Firewall-cmd --permanent --add-port=3306/ TCPCopy the code
Step 10: This step is required if an error is reported using Navicat remote connection
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
Copy the code