1. Download the required MySQL installation package
URL: https: //dev.mysql.com/downloads/mysql/
2.Select Operating System: select Red Hat, CentOS is based on Red Hat, Select OS Version: select linux 7
3. Select RPM Bundle Click Download
4. Click No thanks, just start my download. Download
5. Download good
6. Open VMware, select the virtual machine you want to use, click to open the virtual machine
7. minimize virtual machine, do not control him
8. Open Xshell, select the corresponding virtual machine ip session, click on the link
9. successful connection
10. Adoption of the rpm -qa | grep mariadb command to view mariadb installation package
11. Handling command by MariaDB rpm mariadb-libs-5.5.56-2.el7.x86_64 --nodeps -e
12. Adoption of the rpm -qa | grep mariadb command to view mariadb installation package again
13. By cd / usr / local / command to enter the local directory under the usr directory under the root directory, the directory is to put some local shared resources
14. ll look through the directory structure of command in the current directory
15. Create a directory named mysql in the current directory by mkdir mysql command
16. By order ll look at the directory structure in the current directory, mysql directory just created with
17. Go to the directory by cd mysql command mysql
18. ll look through the directory structure of command in the current directory
19. Click on the window - >> new transfer files via ftp protocol to just download the installation package mysql good transport system to CentOS7
20. Find your mysql installation package download directory on the left
21. On the file you want to transfer a single right-click transfer
22. After a successful upload, ftp transfer tools close
23. ll look through the directory structure of command in the current directory
24. A tar packets decompressed by tar -xvf mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar command
25. clear look through the clear screen command
26. By common mounting rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm --nodeps --force command
27. By mounting libs rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm --nodeps --force command
28. By installing the client rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm --nodeps --force command
29. The server installation by rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm --nodeps --force command
30. By rpm -qa | grep mysql mysql command to view the installation package
31. The following command to complete the initialization and configuration database mysql
mysqld --initialize;
chown mysql:mysql /var/lib/mysql -R;
systemctl start mysqld.service;
systemctl enable mysqld;
The first step here if an error is executed
rpm -qa | grep libaio
After running this command system found in the non-link library file
Use the command, yum install libaio-devel.x86_64
After successful installation, continue to run the database initialization command prompt success.
The third step is to start here if mysql error, check the log mysql
If yum is installed, the default is /var/log/mysqld.log
View Log command: tail -n 500 -f /var/log/mysqld.log
32. By cat /var/log/mysqld.log | grep password command to view the password for the database
33. By mysql -uroot -p hit the Enter key to enter the database login interface
34. Enter the password just found, landing database, copy and paste on the line, MySQL login password is not displayed
35. By ALTER USER 'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; command to change the password
36. By exit; command to exit MySQL, then log in again with the new password
37. By the following command to authorize remote access
create user 'root'@'%' identified with mysql_native_password by 'root';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;
If the error here to change the password, use the following statement
ALTER USER 'root'@'localhost' IDENTIFIED BY '*{your-password}*';
38. By ALTER USER 'root' @ 'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER; command to modify the encryption rule, MySql8.0 version 5.0 and encryption rules are not the same, but now visualization tool only supports the old encryption.
39. By flush privileges; refresh command authority after the repair
40. By exit; command to exit MySQL
41. By the following command to close the firewall
systemctl stop firewalld.service;
systemctl disable firewalld.service;
systemctl mask firewalld.service;
42. Installation iptables firewall yum -y install iptables-services command
43. Start the firewall settings using the following command
systemctl enable iptables;
systemctl start iptables;
44. The command to edit the firewall through vim / etc / sysconfig / iptables, add the port
45. Click i to enter insert mode
46. In the relevant position, writes the following
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8090 -j ACCEPT
47. Click the ESC key to exit insert mode
48. Click: key, enter wq hit the Enter key to save and exit: English for the next state
49. Restart firewall systemctl restart iptables.service order to validate the configuration
50. Set up a firewall boot command by systemctl enable iptables.service
51. The view through the ifconfig command ip
52. New Connection of SQLyog
53. The connection is successful
If the connection is not on visual tools proceeds mysql
- Open the terminal, enter the command
mysql -u root -p
- It should be noted that the password for the MySQL set must contain at least one uppercase letter, one lowercase letter, one special symbol, a number, at least eight characters; the password is in the beginning to install MySQL settings, if forgotten, Internet to resolve any issues.
- After entering your password, enter> mysql command-line mode
# 切换到 mysql 数据库 use mysql; # 设置用户密码永不过期 alter user 'root'@'localhost' identified by 'your pwd' password expire never; # 用「mysql_native_password」加密方式更新 root 用户密码 alter user 'root'@'localhost' identified with mysql_native_password by 'your pwd'; # 刷新 flush privileges;