How to uninstall MySQL

  • 7012894
  • 17-Jul-2013
  • 17-Jul-2013

Environment

Novell Vibe OnPrem
SUSE Linux Enterprise Server 11

Situation

Unable to connect to MySQL database as root and don't know the current password to change it.
When trying to access the MySQL database, the following error is displayed:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Resolution

If the current root password is known, you can change the root password with the following command:
mysqladmin -uroot -p<currentPass> password <newPass>

Back up any Vibe Data that is needed, see documentation for Backing Up and Restoring Vibe Data.
Please follow these steps to uninstall MySQL:
  1. YaST | Software Management | Search for mysql
  2. Right-click mysql Server part of MySQL Community Server and select Delete
  3. Select Accept
  4. Either remove or rename /var/lib/mysql:
    • rm -R /var/lib/mysql
    • mv /var/lib/mysql /var/lib/mysql.old

Please follow these steps to reinstall MySQL fresh (creation of new password):

  1. YaST | Software Management | Search for mysql
  2. Right-click mysql Server part of MySQL Community Server and select Install
  3. Select Accept and Continue.
  4. Start the MySQL daemon:
    rcmysql start
  5. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:

    /usr/bin/mysqladmin -u root password 'new-password'
    /usr/bin/mysqladmin -u root -h tharris7 password 'new-password'

Cause

Uninstall / Reinstall MySQL - prompts creation for a fresh new root password in case the original root password has been forgotten. There are possibly other solutions or workarounds to this issue, but this is one way to get a freshly created password for root.