Solve the Problem of uninstalling MySQL in CentOS

Source: Internet
Author: User

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
  1. [Root @ localhostopt] # rpm-ivhMySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
  2. Preparing... ######################################## ### [100%]
  3. 1: mySQL-server ##################################### ###### [100%]

Enter the following command to uninstall the installation:

[Plain] view plaincopy
  1. [Root @ localhostopt] # rpm-ivhMySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
  2. Preparing... ######################################## ### [100%]
  3. 1: mySQL-server ##################################### ###### [100%]
  4. 2014-09-2307: 22: 430 [Warning] timestampwithimplicitdefavaluvalueisdeprecated. Pleaseuse -- explicit_defaults_for_timestampserveroption (seedocumentationformoredetails ).
  5. 2014-09-2307: 22: 4326041 [Note] InnoDB: Usingatomicstorefcountbufferpoolpages
  6. 2014-09-2307: 22: 4326041 [Note] InnoDB: TheInnoDBmemoryheapisdisabled
  7. 2014-09-2307: 22: 4326041 [Note] InnoDB: Mutexesandrw_locksuseGCCatomicbuiltins
  8. 2014-09-2307: 22: 4326041 [Note] InnoDB: Compressedtablesusezlib1.2.3
  9. 2014-09-2307: 22: 4326041 [Note] InnoDB: UsingLinuxnativeAIO
  10. 2014-09-2307: 22: 4326041 [Note] InnoDB: UsingCPUcrc32instructions
  11. 2014-09-2307: 22: 4326041 [Note] InnoDB: Initializingbufferpool, size = 128.0 M
  12. 2014-09-2307: 22: 4326041 [Note] InnoDB: Completedinitializationofbufferpool
  13. 2014-09-2307: 22: 4326041 [Note] InnoDB: Thefirstspecifieddatafile./ibdata1didnotexist: anewdatabasetobecreated!
  14. 2014-09-2307: 22: 4326041 [Note] InnoDB: Settingfile./ibdata1sizeto12MB
  15. 2014-09-2307: 22: 4326041 [Note] InnoDB: Databasephysicallywritesthefilefull: wait...
  16. 2014-09-2307: 22: 4326041 [Note] InnoDB: Settinglogfile./ib_logfile101sizeto48MB
  17. 2014-09-2307: 22: 4326041 [Note] InnoDB: Settinglogfile./ib_logfile1sizeto48MB
  18. 2014-09-2307: 22: 4526041 [Note] InnoDB: Renaminglogfile./ib_logfile101to./ib_logfile0
  19. 2014-09-2307: 22: 4526041 [Warning] InnoDB: Newlogfilescreated, LSN = 45781
  20. 2014-09-2307: 22: 4526041 [Note] InnoDB: Doublewritebuffernotfound: creatingnew
  21. 2014-09-2307: 22: 4526041 [Note] InnoDB: Doublewritebuffercreated
  22. 2014-09-2307: 22: 4526041 [Note] InnoDB: 128 rollbacksegment (s) areactive.
  23. 2014-09-2307: 22: 4526041 [Warning] InnoDB: Creatingforeignkeyconstraintsystemtables.
  24. 2014-09-2307: 22: 4526041 [Note] InnoDB: Foreignkeyconstraintsystemtablescreated
  25. 2014-09-2307: 22: 4526041 [Note] InnoDB: Creatingtablespaceanddatafilesystemtables.
  26. 2014-09-2307: 22: 4526041 [Note] InnoDB: Tablespaceanddatafilesystemtablescreated.
  27. 2014-09-2307: 22: 4526041 [Note] InnoDB: Waitingforpurgetostart
  28. 2014-09-2307: 22: 4526041 [Note] InnoDB: 5.6.19started; logsequencenumber0
  29. Arandomrootpasswordhasbeenset. Youwillfinditin '/root/. mysql_secret '.
  30. 2014-09-2307: 22: 4626041 [Note] Binlogend
  31. 2014-09-2307: 22: 4626041 [Note] InnoDB: FTSoptimizethreadexiting.
  32. 2014-09-2307: 22: 4626041 [Note] InnoDB: Startingshutdown...
  33. 2014-09-2307: 22: 4826041 [Note] InnoDB: Shutdowncompleted; logsequencenumber1625977
  34. 2014-09-2307: 22: 480 [Warning] timestampwithimplicitdefavaluvalueisdeprecated. Pleaseuse -- explicit_defaults_for_timestampserveroption (seedocumentationformoredetails ).
  35. 2014-09-2307: 22: 4826065 [Note] InnoDB: Usingatomicstorefcountbufferpoolpages
  36. 2014-09-2307: 22: 4826065 [Note] InnoDB: TheInnoDBmemoryheapisdisabled
  37. 2014-09-2307: 22: 4826065 [Note] InnoDB: Mutexesandrw_locksuseGCCatomicbuiltins
  38. 2014-09-2307: 22: 4826065 [Note] InnoDB: Compressedtablesusezlib1.2.3
  39. 2014-09-2307: 22: 4826065 [Note] InnoDB: UsingLinuxnativeAIO
  40. 2014-09-2307: 22: 4826065 [Note] InnoDB: UsingCPUcrc32instructions
  41. 2014-09-2307: 22: 4826065 [Note] InnoDB: Initializingbufferpool, size = 128.0 M
  42. 2014-09-2307: 22: 4826065 [Note] InnoDB: Completedinitializationofbufferpool
  43. 2014-09-2307: 22: 4826065 [Note] InnoDB: HighestsupportedfileformatisBarracuda.
  44. 2014-09-2307: 22: 4826065 [Note] InnoDB: 128 rollbacksegment (s) areactive.
  45. 2014-09-2307: 22: 4826065 [Note] InnoDB: Waitingforpurgetostart
  46. 2014-09-2307: 22: 4826065 [Note] InnoDB: 5.6.19started; logsequencenumber1625977
  47. 2014-09-2307: 22: 4826065 [Note] Binlogend
  48. 2014-09-2307: 22: 4826065 [Note] InnoDB: FTSoptimizethreadexiting.
  49. 2014-09-2307: 22: 4826065 [Note] InnoDB: Startingshutdown...
  50. 2014-09-2307: 22: 5026065 [Note] InnoDB: Shutdowncompleted; logsequencenumber1625987
  51. ARANDOMPASSWORDHASBEENSETFORTHEMySQLrootUSER!
  52. Youwillfindthatpasswordin '/root/. mysql_secret '.
  53. Youmustchangethatpasswordonyourfirstconnect,
  54. Nootherstatementbut 'setpassword' willbeaccepted.
  55. Seethemanualforthesemanticsofthe 'passwordexpired' flag.
  56. Also, theaccountfortheanonymoususerhasbeenremoved.
  57. Inaddition, youcanrun:
  58. /Usr/bin/mysql_secure_installation
  59. Whichwillalsogiveyoutheoptionofremovingthetestdatabase.
  60. Thisisstronglyrecommendedforproductionservers.
  61. Seethemanualformoreinstructions.
  62. Pleasereportanyproblemsathttp: // bugs.mysql.com/
  63. ThelatestinformationaboutMySQLisavailableonthewebat
  64. Http://www.mysql.com
  65. SupportMySQLbybuyingsupport/licensesathttp: // shop.mysql.com
  66. Newdefaultconfigfilewascreatedas/usr/my. cnfand
  67. Willbeusedbydefaultbytheserverwhenyoustartit.
  68. 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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.