centos system
MysqlCommunityServer8.0.24
MysqlWorkbench8.0.22
First, delete mysql from centos system
The reason for deletion is that it does not fit
Version 8.0.24 of MysqlCommunity and MysqlWorkbench are installed
Step 1
First check whether the system comes with Mysql
[dalaojun@localhost download]$ whereis mysql mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
View the built-in version number
[dalaojun@localhost download]$ mysql -V mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1 [dalaojun@localhost download]$
Step 2
Check whether mysql is currently running
see MySQL Service status service mysqld status suspend MySQL service service mysqld stop
Close the mysql service before uninstalling
View mysql installation package
Check whether mysql installed in rpm package is available in the system
rpm -qa|grep -i mysql
Uninstall after closing mysql service
sudo rpm -ev --nodeps
-e uninstall the software in the system
-v detail the installation process
– nodeps means that dependencies are not checked during installation
– force forced installation
[dalaojun@localhost mysql]$ rpm -qa|grep -i mysql perl-DBD-MySQL-4.023-6.el7.x86_64 MySQL-python-1.2.5-1.el7.x86_64 qt3-MySQL-3.3.8b-51.el7.x86_64 # [dalaojun@localhost mysql]$ sudo rpm -ev --nodeps perl-DBD-MySQL-4.023-6.el7.x86_64 Package preparation in progress... perl-DBD-MySQL-4.023-6.el7.x86_64 [dalaojun@localhost mysql]$ sudo rpm -ev --nodeps MySQL-python-1.2.5-1.el7.x86_64 Package preparation in progress... MySQL-python-1.2.5-1.el7.x86_64 [dalaojun@localhost mysql]$ sudo rpm -ev --nodeps qt3-MySQL-3.3.8b-51.el7.x86_64 Package preparation in progress... qt3-MySQL-3.3.8b-51.el7.x86_64 [dalaojun@localhost mysql]$ rpm -qa|grep -i mysql [dalaojun@localhost mysql]$
Step 3
Uninstall MariaDB
sudo yum remove mariadb
You need root Permission to execute this command. [dalaojun@localhost download]$ sudo yum remove mariadb mariadb-server [sudo] dalaojun Password for: Plug in loaded: fastestmirror, langpacks Resolving dependencies --> Checking transactions ---> software package mariadb.x86_64.1.5.5.68-1.el7 Will be deleted ---> software package mariadb-server.x86_64.1.5.5.68-1.el7 Will be deleted --> Processing dependencies mariadb-server,It is a software package akonadi-mysql-1.9.2-4.el7.x86_64 need --> Checking transactions ---> software package akonadi-mysql.x86_64.0.1.9.2-4.el7 Will be deleted --> Resolve dependency complete base/7/x86_64 | 3.6 kB 00:00 copr:copr.fedorainfracloud.org:librehat:shadowsocks/x86_ | 3.3 kB 00:00 epel/x86_64 | 4.7 kB 00:00 epel/x86_64/updateinfo | 1.0 MB 00:00 epel/x86_64/primary_db | 6.9 MB 00:02 extras/7/x86_64 | 2.9 kB 00:00 google-chrome | 1.3 kB 00:00 nux-dextop/x86_64 | 2.9 kB 00:00 teamviewer/x86_64/signature | 867 B 00:00 teamviewer/x86_64/signature | 2.5 kB 00:00 !!! updates/7/x86_64 | 2.9 kB 00:00 Dependency resolution ================================================================================ Package framework edition source size ================================================================================ Deleting: mariadb x86_64 1:5.5.68-1.el7 @base 49 M mariadb-server x86_64 1:5.5.68-1.el7 @base 58 M Remove for dependency: akonadi-mysql x86_64 1.9.2-4.el7 @anaconda 9.6 k Transaction summary ================================================================================ Remove 2 packages (+1 Dependent packages) Installation size: 107 M Continue?[y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPM The database has been deleted yum Program modification. Deleting : akonadi-mysql-1.9.2-4.el7.x86_64 1/3 Deleting : 1:mariadb-server-5.5.68-1.el7.x86_64 2/3 Deleting : 1:mariadb-5.5.68-1.el7.x86_64 3/3 Verification in progress : 1:mariadb-server-5.5.68-1.el7.x86_64 1/3 Verification in progress : akonadi-mysql-1.9.2-4.el7.x86_64 2/3 Verification in progress : 1:mariadb-5.5.68-1.el7.x86_64 3/3 delete: mariadb.x86_64 1:5.5.68-1.el7 mariadb-server.x86_64 1:5.5.68-1.el7 Deleted as dependency: akonadi-mysql.x86_64 0:1.9.2-4.el7 complete!
Step 4
Delete relevant software
[dalaojun@localhost etc]$ rpm -qa|grep mysql qt5-qtbase-mysql-5.9.7-5.el7_9.x86_64 qt-mysql-4.8.7-9.el7_9.x86_64 [dalaojun@localhost etc]$ [dalaojun@localhost etc]$ sudo rpm -e --nodeps qt5-qtbase-mysql-5.9.7-5.el7_9.x86_64 [dalaojun@localhost etc]$ sudo rpm -e --nodeps qt-mysql-4.8.7-9.el7_9.x86_64 [dalaojun@localhost etc]$
Delete relevant software
[dalaojun@localhost etc]$ rpm -qa | grep mariadb mariadb-libs-5.5.68-1.el7.x86_64 mariadb-devel-5.5.68-1.el7.x86_64 [dalaojun@localhost etc]$ sudo rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64 [sudo] dalaojun Password for: [dalaojun@localhost etc]$ sudo rpm -e --nodeps mariadb-devel-5.5.68-1.el7.x86_64 [dalaojun@localhost etc]$
View the command comments of the corresponding mysql files and software
-qa: Find the corresponding file, such as rpm -qa mysql rpm -q mysql list mysql Installation information for rpm -qa|grep mysql Yes list contains mysql Field of the software. stop it mysql Services, remove previously installed mysql Delete command: rpm -e –nodeps <Package name>
Step 5
View the mysql file directory and delete the file directory
[dalaojun@localhost etc]$ whereis mysql mysql: /usr/lib64/mysql /usr/include/mysql /usr/share/mysql [dalaojun@localhost etc]$rm -rf /usr/lib64/mysql [dalaojun@localhost etc]$rm -rf /usr/include/mysql [dalaojun@localhost etc]$rm -rf /usr/share/mysql
Use the command rm -rf xxx to delete the above files in sequence
Step 6
Check whether the relevant files exist again
[dalaojun@localhost etc]$ whereis mysql [dalaojun@localhost etc] [dalaojun@localhost etc]$ rpm -qa|grep mysql [dalaojun@localhost etc]$ rpm -qa|grep mariadb [dalaojun@localhost etc]$
If there is any, delete it again
Step 7
After uninstalling mysql, / etc / my CNF will not be deleted and needs to be deleted manually
rm /etc/my.cnf
download
Mysql official website
https://dev.mysql.com/downloads/
Enter the MysqlCommunity and MysqlWorkbench download page
Choose to download a stable version
The first installation method is tar package installation
(the second method is recommended)
Select the below, thank you, download directly
No thanks, just start my download.
I downloaded MysqlCommunityServer, which is a tar package
If your is CentOS 8, it's the following one
mysql-8.0.24-1.el8.x86_64.rpm-bundle.tar
(if you don't have tar on your computer, the decompression software installation command of tar is yum install -y tar)
If your bag is tar The end of XZ needs to be decompressed once in advance
xz -d mysql-8.0.24-1.el8.x86_64.rpm-bundle.tar.xz
Create a mysql folder in the location of the current package
mkdir mysql
mysql-8.0.24-1 el8. x86_ 64.rpm-bundle. Move tar to mysql folder
mv mysql-8.0.24-1.el8.x86_64.rpm-bundle.tar /mysql
Enter mysql folder
cd mysql
tar package decompression
sudo tar -xvf mysql-8.0.24-1.el8.x86_64.rpm-bundle.tar
Move the mysql folder to / usr/local /
Return to the previous level
cd ..
move
sudo mv mysql /usr/local/mysql
If you make an installation error, browse to the bottom of this article
Branch 1: install using python script
#If your downloaded package is 8.0.24-1, copy this code directly and save it to XXX Py file execution import os #Synchronization, one by one, has been sorted list=["sudo rpm -ivh /usr/local/mysql/mysql-community-common-8.0.24-1.el8.x86_64.rpm", "sudo rpm -ivh /usr/local/mysql/mysql-community-client-8.0.24-1.el8.x86_64.rpm", "sudo rpm -ivh /usr/local/mysql/mysql-community-libs-8.0.24-1.el8.x86_64.rpm", "sudo rpm -ivh /usr/local/mysql/mysql-community-server-8.0.24-1.el8.x86_64.rpm"] for i in list: os.system(i)
Branch 2:
Manual installation
sudo rpm -ivh /usr/local/mysql/mysql-community-common-8.0.24-1.el8.x86_64.rpm sudo rpm -ivh /usr/local/mysql/mysql-community-client-8.0.24-1.el8.x86_64.rpm sudo rpm -ivh /usr/local/mysql/mysql-community-libs-8.0.24-1.el8.x86_64.rpm sudo rpm -ivh /usr/local/mysql/mysql-community-server-8.0.24-1.el8.x86_64.rpm
Second installation method
Use the yum command to install
mysql yum command download page
https://dev.mysql.com/downloads/repo/yum/
After downloading, it is also placed in the usr/local/mysql directory [in fact, there is no need to have a party here, because this package is only a path package and has no impact on the installation. Using this method, the installation system will automatically install it to the default location, which can be found by using whereis mysql]
The following commands are installed for CentOS 7
sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
Then the installation is prompted below
error
Warning: RPM The database has been deleted yum Program modification. ** Found 6 existing RPM Database problems, 'yum check' The output is as follows: 1:net-snmp-5.7.2-49.el7_9.1.x86_64 There is a lack of demand libmysqlclient.so.18()(64bit) 1:net-snmp-5.7.2-49.el7_9.1.x86_64 There is a lack of demand mysql-libs 1:net-snmp-agent-libs-5.7.2-49.el7_9.1.x86_64 There is a lack of demand libmysqlclient.so.18()(64bit) 1:net-snmp-agent-libs-5.7.2-49.el7_9.1.x86_64 There is a lack of demand libmysqlclient.so.18(libmysqlclient_18)(64bit) 2:postfix-2.10.1-9.el7.x86_64 There is a lack of demand libmysqlclient.so.18()(64bit) 2:postfix-2.10.1-9.el7.x86_64 There is a lack of demand libmysqlclient.so.18(libmysqlclient_18)(64bit) Installing : mysql80-community-release-el7-3.noarch 1/1 Verification in progress : mysql80-community-release-el7-3.noarch 1/1 already installed: mysql80-community-release.noarch 0:el7-3 complete!
implement
yum clean all yum Will download the software package and header store in cache Without automatic deletion. Occupy disk space, can use yum clean Command to clear. The more precise usage is yum clean headers eliminate header,yum clean packages Clear downloaded rpm Bag, yum clean all I. clear all
Re execution
yum makecache yum makecache Yes, the package information on the server is now cached locally,To improve the speed of searching and installing software
[dalaojun@localhost mysql]$ yum clean all Plug in loaded: fastestmirror, langpacks Cleaning up software source: base copr:copr.fedorainfracloud.org:librehat:shadowsocks epel : extras google-chrome mysql-connectors-community : mysql-tools-community mysql80-community nux-dextop teamviewer : updates Other repos take up 2.9 G of disk space (use --verbose for details) [dalaojun@localhost mysql]$ yum makecache
Then the system will quickly load the installation package
Plug in required for upgrading computer system
Because mariadb and mysql and some plug-ins were deleted before
Wait until the metadata cache has been established
Execute mysqlserver installation
sudo yum install mysql-community-server
Wait 1 minute and the installation is completed.
Mysql official website
https://dev.mysql.com/downloads/
MySQL workbench installation
centos7.9 system, in rpm format, the latest version is 8.0.22
The of windows is exe
Here is the file name
mysql-workbench-community-8.0.22-1.el7.x86_64.rpm
After downloading, open the terminal at the download location of the software
The installation command is:
sudo rpm -ivh mysql-workbench-community-8.0.22-1.el7.x86_64.rpm
After installation, the shortcut key of the software is
use/share/applications directory
The next chapter explains the design of creating database and building database model, as well as connecting database