Linux --- Install MySQL

MySQL database installation package: mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

Download: wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.17-1.el7.x86_64.rpm-bundle.tar

When installing the mysql-community-libs-8.0.17-1.el7.x86_64.rpm package, you will be prompted to report an error, you need to add --nodeps --force at the end

Filter to view the RPM packages installed by MySQL

Restart MySQL service

When you log in for the first time and do not know the MySQL login password, you need to do the following:

Stop MySQL service and edit the /etc/my.cnf configuration file with vim command

Execute the vim command and add skip-grant-tables to the last line of [mysqld] in the /etc/my.cnf configuration file (skip MySQL permission verification and log in directly)

Log in to the MySQL database and modify the user login password  update user set password=password("new password") where user='user's hostname'; 

Log in to MySQL to view the database

The MySQL database is installed!

 

The following are the installation steps of mysql-5.7.22-1.el7.x86_64.rpm, for reference only:

[root@localhost mysql]# rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
Warning: mysql-community-common-5.7.22-1.el7.x86_64.rpm: header V3 DSA /SHA1 Signature, Key ID 5072e1f5: NOKEY is
preparing... (10############################### [100%]
Upgrading/installing...
   1:mysql-community-common-5.7.22-1.e ####################### ######### [100%]
[root@localhost mysql]# yum remove mysql-libs
loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving dependencies
--> Checking transactions
---> Package mariadb-libs.x86_64.1.5.5.44-2.el7 will be deleted
--> The dependency libmysqlclient.so.18()(64bit) is being processed. It is used by package 2:postfix-2.10. 1-6.el7.x86_64 Required
--> Processing dependency libmysqlclient.so.18(libmysqlclient_18)(64bit), it is required by package 2:postfix-2.10.1-6.el7.x86_64
--> Checking Transaction
---> Package postfix.x86_64.2.2.10.1-6.el7 will be deleted
--> Resolve the dependencies completed

Dependency resolution

================================================== =======================
 Package Architecture Version Source Size
======================= ================================================
is now Delete:
 mariadb-libs x86_64 1:5.5.44-2.el7 @anaconda/7.2 4.4 M
Remove for dependency:
 postfix x86_64 2:2.10.1-6.el7 @anaconda/7.2 12 M

Transaction summary
==================================================================================================================================================================================================================== ========================
Remove 1 package (+1 dependent package)

Installation size: 17 M Do
you want to continue? [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
warning: RPM database has been modified by a non-yum program.
  Deleting: 2:postfix-2.10.1-6.el7.x86_64 1/2 
  Deleting: 1:mariadb-libs-5.5.44-2.el7.x86_64 2/2 
  Verifying: 1:mariadb-libs-5.5 .44-2.el7.x86_64 1/2 
  verifying: 2:postfix-2.10.1-6.el7.x86_64 2/2 

Delete:
  mariadb-libs.x86_64 1:5.5.44-2.el7                                    

Removed as a dependency:
  postfix.x86_64 2:2.10.1-6.el7                                         

complete!
[root@localhost mysql]# rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm 
Warning: mysql-community-common-5.7.22-1.el7.x86_64.rpm: header V3 DSA /SHA1 Signature, Key ID 5072e1f5: NOKEY is
preparing... (10############################### [100%]
    Package mysql-community-common-8.0.19-1.el7.x86_64 (newer than mysql-community-common-5.7.22-1.el7.x86_64)
[root@localhost mysql] has been installed # rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm --nodeps --force 
warning: mysql-community-libs-5.7.22-1.el7.x86_64.rpm: header V3 DSA /SHA1 Signature, Key ID 5072e1f5: NOKEY is
preparing... (10############################### [100%]
Upgrading/installing...
   1:mysql-community-libs-5.7.22-1.el7 ################################ [100 %]
[root@localhost mysql]# rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm 
Warning: mysql-community-client-5.7.22-1.el7.x86_64.rpm: header V3 DSA/SHA1 Signature, Key ID 5072e1f5: NOKEY is
preparing... (10############################# ## [100%]
Upgrading/installing...
   1:mysql-community-client-5.7.22-1.e ##################### ########### [100%]
[root@localhost mysql]# rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm --nodeps --force
warning: mysql-community-server-5.7.22-1.el7.x86_64.rpm: header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
In preparation... (10############################### [100%]
Upgrading/installing... .
   1:mysql-community-server-5.7.22-1.e ################################ [ 100%]
[root@localhost mysql]# 

Guess you like

Origin blog.csdn.net/C_huid/article/details/105599351