Managing Databases via SSH
How to Delete a Database via SSH
To delete a database using SSH, follow these steps:
Backup the database first
Run the following command in your SSH terminal (replace username and database with your actual values):
Enter your cPanel password when prompted.
Connect to MySQL
Verify the database exists
Delete (Drop) the database
Confirm deletion
The result should be an empty set — meaning the database has been successfully removed.
For detailed syntax, refer to MySQL’s official DROP DATABASE documentation.
You can remove user accounts (and their privileges) using the DROP USER statement.
Syntax:
Example (single user):
Example (multiple users):
Deleting a user will also remove all privileges associated with that account.
To grant permissions to a user, you must have CREATE USER and GRANT privileges.
Syntax:
Example:
This gives the user snappy02 the ability to select, insert, and delete records within the example_db database.
To check a user’s assigned privileges:
Syntax:
Example:
Sample Output: