Table of contents
1. Query the mysql that comes with the system
2. Uninstall the mysql that comes with the system
3. Create a storage point for the mysql installation package
4. Upload the mysql-5.7.29 installation package to the above folder and unzip it
7. Change the group you belong to
9. View the generated temporary root password
10. Modify the MySQL root password and authorize remote access
11. Update root password and set root
13. Check the startup and shutdown status of mysql
14: It is recommended to set it as a self-starting service after booting
15: Check whether the self-start has been set successfully
install mysql
1. Query the mysql that comes with the system
rpm -qa|grep mariadb
2. Uninstall the mysql that comes with the system
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
3. Create a storage point for the mysql installation package
mkdir -p /export/software/mysql
4. Upload the mysql-5.7.29 installation package to the above folder and unzip it
Unzip: tar -xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
5. Execute the installation
This package is required to execute the following first: yum -y install libaio
Execute the installed dependencies
rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.29-1.el7.x86_64.rpm
6, initialize mysql
mysqld --initialize
7. Change the group you belong to
chown mysql:mysql /var/lib/mysql -R
8, start mysql
start mysql
systemctl start mysqld.service
View mysql status
systemctl status mysqld.service
9. View the generated temporary root password
cat /var/log/mysqld.log
At the end of this line of logs is a randomly generated temporary password.
10. Modify the MySQL root password and authorize remote access
mysql -u root -p
Enter password: #Enter the temporary password generated in the log here
11. Update root password and set root
mysql> alter user user() identified by "root";
Query OK, 0 rows affected (0.00 sec)
12. Authorization
mysql> use mysql;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
13. Check the startup and shutdown status of mysql
systemctl stop mysqld
systemctl status mysqld
systemctl start mysqld
14: It is recommended to set it as a self-starting service after booting
systemctl enable mysqld
15: Check whether the self-start has been set successfully
systemctl list-unit-files | grep mysqld