Solve the Problem of uninstalling MySQL in CentOS
In CentOS, how does one completely uninstall MySQL? Solve the Problem of uninstallation being unclean
System: CentOS 6.5, MySQL: MySql 5.6
Here, we mainly solve the problem of installing and uninstalling with rpm. For the installation method, see: how to install mysql with CentOS *. rpm prompt conflicts with file from package.
Although here is the problem of installing and uninstalling with rpm, I think yum installation is also applicable if the same problem occurs.
View the installed Service rpm-qa | grep-I mysql
-I is case insensitive.
We can see there are two installation package MySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-client-5.6.19-1.linux_glibc2.5.x86_64.rpm
Delete these two services (remove the suffix) rpm-e MySQL-client-5.6.19-1.linux_glibc2.5.x86_64
Rpm e MySQL-server-5.6.19-1.linux_glibc2.5.x86_64
View the residual directory:
Whereis mysql
Then delete the mysql directory:
Rm-rf/usr/lib64/mysql
Delete Related Files: rm-rf/usr/my. cnf
Rm-rf/root/. mysql_sercret
Key:
Rm-rf/var/lib/mysql
If this directory is not deleted, after re-installation, the password is still the previous password and will not be reinitialized!
I haven't mentioned this on the internet for a long time. I finally found it myself.
Uninstalled successfully! Are you sure you want to uninstall it?
First, check the installation output:
If the server is not uninstalled, only two lines are entered during server installation:
[Plain] view plaincopy
- [Root @ localhostopt] # rpm-ivhMySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
- Preparing... ######################################## ### [100%]
- 1: mySQL-server ##################################### ###### [100%]
Enter the following command to uninstall the installation:
[Plain] view plaincopy
- [Root @ localhostopt] # rpm-ivhMySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
- Preparing... ######################################## ### [100%]
- 1: mySQL-server ##################################### ###### [100%]
- 2014-09-2307: 22: 430 [Warning] timestampwithimplicitdefavaluvalueisdeprecated. Pleaseuse -- explicit_defaults_for_timestampserveroption (seedocumentationformoredetails ).
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Usingatomicstorefcountbufferpoolpages
- 2014-09-2307: 22: 4326041 [Note] InnoDB: TheInnoDBmemoryheapisdisabled
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Mutexesandrw_locksuseGCCatomicbuiltins
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Compressedtablesusezlib1.2.3
- 2014-09-2307: 22: 4326041 [Note] InnoDB: UsingLinuxnativeAIO
- 2014-09-2307: 22: 4326041 [Note] InnoDB: UsingCPUcrc32instructions
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Initializingbufferpool, size = 128.0 M
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Completedinitializationofbufferpool
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Thefirstspecifieddatafile./ibdata1didnotexist: anewdatabasetobecreated!
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Settingfile./ibdata1sizeto12MB
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Databasephysicallywritesthefilefull: wait...
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Settinglogfile./ib_logfile101sizeto48MB
- 2014-09-2307: 22: 4326041 [Note] InnoDB: Settinglogfile./ib_logfile1sizeto48MB
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Renaminglogfile./ib_logfile101to./ib_logfile0
- 2014-09-2307: 22: 4526041 [Warning] InnoDB: Newlogfilescreated, LSN = 45781
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Doublewritebuffernotfound: creatingnew
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Doublewritebuffercreated
- 2014-09-2307: 22: 4526041 [Note] InnoDB: 128 rollbacksegment (s) areactive.
- 2014-09-2307: 22: 4526041 [Warning] InnoDB: Creatingforeignkeyconstraintsystemtables.
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Foreignkeyconstraintsystemtablescreated
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Creatingtablespaceanddatafilesystemtables.
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Tablespaceanddatafilesystemtablescreated.
- 2014-09-2307: 22: 4526041 [Note] InnoDB: Waitingforpurgetostart
- 2014-09-2307: 22: 4526041 [Note] InnoDB: 5.6.19started; logsequencenumber0
- Arandomrootpasswordhasbeenset. Youwillfinditin '/root/. mysql_secret '.
- 2014-09-2307: 22: 4626041 [Note] Binlogend
- 2014-09-2307: 22: 4626041 [Note] InnoDB: FTSoptimizethreadexiting.
- 2014-09-2307: 22: 4626041 [Note] InnoDB: Startingshutdown...
- 2014-09-2307: 22: 4826041 [Note] InnoDB: Shutdowncompleted; logsequencenumber1625977
- 2014-09-2307: 22: 480 [Warning] timestampwithimplicitdefavaluvalueisdeprecated. Pleaseuse -- explicit_defaults_for_timestampserveroption (seedocumentationformoredetails ).
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Usingatomicstorefcountbufferpoolpages
- 2014-09-2307: 22: 4826065 [Note] InnoDB: TheInnoDBmemoryheapisdisabled
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Mutexesandrw_locksuseGCCatomicbuiltins
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Compressedtablesusezlib1.2.3
- 2014-09-2307: 22: 4826065 [Note] InnoDB: UsingLinuxnativeAIO
- 2014-09-2307: 22: 4826065 [Note] InnoDB: UsingCPUcrc32instructions
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Initializingbufferpool, size = 128.0 M
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Completedinitializationofbufferpool
- 2014-09-2307: 22: 4826065 [Note] InnoDB: HighestsupportedfileformatisBarracuda.
- 2014-09-2307: 22: 4826065 [Note] InnoDB: 128 rollbacksegment (s) areactive.
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Waitingforpurgetostart
- 2014-09-2307: 22: 4826065 [Note] InnoDB: 5.6.19started; logsequencenumber1625977
- 2014-09-2307: 22: 4826065 [Note] Binlogend
- 2014-09-2307: 22: 4826065 [Note] InnoDB: FTSoptimizethreadexiting.
- 2014-09-2307: 22: 4826065 [Note] InnoDB: Startingshutdown...
- 2014-09-2307: 22: 5026065 [Note] InnoDB: Shutdowncompleted; logsequencenumber1625987
- ARANDOMPASSWORDHASBEENSETFORTHEMySQLrootUSER!
- Youwillfindthatpasswordin '/root/. mysql_secret '.
- Youmustchangethatpasswordonyourfirstconnect,
- Nootherstatementbut 'setpassword' willbeaccepted.
- Seethemanualforthesemanticsofthe 'passwordexpired' flag.
- Also, theaccountfortheanonymoususerhasbeenremoved.
- Inaddition, youcanrun:
- /Usr/bin/mysql_secure_installation
- Whichwillalsogiveyoutheoptionofremovingthetestdatabase.
- Thisisstronglyrecommendedforproductionservers.
- Seethemanualformoreinstructions.
- Pleasereportanyproblemsathttp: // bugs.mysql.com/
- ThelatestinformationaboutMySQLisavailableonthewebat
- Http://www.mysql.com
- SupportMySQLbybuyingsupport/licensesathttp: // shop.mysql.com
- Newdefaultconfigfilewascreatedas/usr/my. cnfand
- Willbeusedbydefaultbytheserverwhenyoustartit.
- Youmayeditthisfiletochangeserversettings
Important information is prompted in the last section. Many people do not know how to perform this operation because they do not like to read English!
Second, the installation is complete. After the service is started
Run the command: "mysql-uroot-p" and enter the password you set after installation to check whether you can log on. If you can log on again, it indicates that it has not been uninstalled!