How to eliminate a MySQL User using SSH

January 22, 2024 / MySQL

Removing a MySQL user via SSH is detailed in this guide, where a MySQL user, recorded in the USER table of the MySQL server is deleted along with its linked host information, login details, and account privileges.

Follow the simple steps-

  1. Using SSH, log in to your server.
  2. Access MySQL prompt.
  3. Select the database “MySQL”.
  4. The database name needs to be changed as displayed below-
    mysql> use mysql;
    mysql> DELETE FROM user where user=’mysqltest’;
    mysql> FLUSH PRIVILEGES;
  5. Modify the username to the target user’s name and select the appropriate table storing user records. Also, execute this command under the root user or an account with the required privileges as per the grant tables.

This process allows you to delete a MySQL user through SSH.

When you remove MySQL users, it will not delete the database or data associated with them. Therefore, taking a backup is not mandatory. However, it is a good practice to back up a MySQL database if there is any uncertainty or if you want to save it somewhere where MySQL users have certain privileges.

Spread the love
Dominos Search