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-
- Using SSH, log in to your server.
- Access MySQL prompt.
- Select the database “MySQL”.
- The database name needs to be changed as displayed below-
mysql> use mysql;
mysql> DELETE FROM user where user=’mysqltest’;
mysql> FLUSH PRIVILEGES;
- 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.