Centos7 offline installation of MySQL tutorial


1. Delete the original MariaDB, otherwise MySQL cannot be installed

rpm -qa|grep mariadb
rpm -e --nodeps mariadb-libs

1. In https://dev.mysql.com/downloads/mysql/ Select Red Hat Enterprise Linux 7 / Oracle Linux 7, and select OS version as all.

Direct downloadmysql-5.7.21-1.el7.x86_64.rpm-bundle.tarAll the RPM packages are in it

rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm
 rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm 
rpm -ivh mysql-community-devel-5.7.21-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm 
rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
 rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

So far, all the files of mysql5.7 have been installed, and the next step is to start the service test.

1. First, close the MySQL service

service mysqld stop

2. Then modify the configuration file:

vim /etc/my.cnf

3. Add a code to login MySQL with empty password

# Disabling symbolic-links is recommended to prevent assorted security risks
Skip grant tables ා add this sentence. At this time, you don't need a password to log in to MySQL

4. Start MySQL service:

service mysqld start

5. Login MySQL with empty password:

MySQL - U root - P # enter the command and press enter. When the password prompt appears, press enter directly

6. Set MySQL password:

mysql> set password for [email protected] = password('123456');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
MySQL > flush privileges; # update permissions
Query OK, 0 rows affected (0.00 sec)
mysql> set password for [email protected] = password('123456'); 
Query OK, 0 rows affected, 1 warning (0.00 sec)
MySQL > flush privileges; # update permissions
MySQL > quit; # exit
Service mysqld stop # stop the MySQL service and restore the MySQL configuration
vim /etc/ my.cnf    #Modify configuration file
# Disabling symbolic-links is recommended to prevent assorted security risks
#Skip grant tables
Service mysqld start # start the MySQL service
MySQL - uroot - P # enter new password to login

7. Set Mysql to boot automatically:

systemctl enable mysqld


The above is a tutorial of offline installation of MySQL for centos7 introduced by Xiaobian. I hope it can help you. If you have any questions, please leave me a message and Xiaobian will reply you in time. Thank you very much for your support to developer!
If you think this article is helpful to you, please reprint, please indicate the source, thank you!

Recommended Today

. net Maui preview 5 function Preview

Although Microsoft build has just passed, we will continue to share our continuous progress in. Net multi platform application UI (. Net Maui). In this release, we have enabled animation and view transformation, completed the migration of multiple UI components, and improved a single project template.We also released the first batch of preview documents covering […]