Requirements: Install the MySQL 5.7.36 Community Release database on a CentOS 7 system.
Review:
Preparation
Before installing the MySQL database, CentOS 7 needs to do some preparation and install the required dependencies with the following commands:
Uninstall mariadb
If you do not uninstall it, when installing the libs package, you will get the following error:
error: Failed dependencies: mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.36-1.el7.x86_64 mariadb-libs is obsoleted by mysql-community-libs-5.7.36-1.el7.x86_64 Review and uninstall
Download and unzip mysql-5.7.36
Download Address:The hyperlink login is visible.Select the required version, operating system, and system version, as shown in the following figure:
Download the unzip command as follows:
Start installing mysql-5.7.36
Run the following command to install:
Start MySQL
After the installation is completed, the MySQL service is booted by default, and the command to start the MySQL service is as follows:
To view the temporary password, the command is as follows:
To connect to a MySQL database, users before MySQL version 5.7.6 can use the following command to change the default password:
If you do not set a new password, the error will be as follows:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. If the password does not meet the requirements, the following error will be reported:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements Create a new oneRoot accounts that allow remote connections, the command is as follows:
Allows access to port 3306
The default port of the MySQL database is 3306, if the firewall is enabled, you need to release port 3306 to allow external clients to access, and the command is as follows:
Try using the MySQL database connection tool, using dbeaver as an example, the connection is successful, as shown in the following figure:
MySQL configuration
If you need to tune MySQL and modify some configuration items of the service, edit the following file:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf (End)
|