I want to delete my database and the user for it because I need to make a new import. Normally I do this through cPanel but it doesnt seem to delete it, even though it states that it did.

So guys, how the heck do I do this? Maybe there is a way to do it in WHM? Im running RedHat x86_64 es5. I am not experienced with servers so please be specific in any replies. Cheers!


First ssh into your box. Like this:

ssh username@ip

Assuming you have not disabled password authentication, you should be able to enter your username / password after this.

Then, get into mysql:

sudo mysql -p

Enter your root mysql password. Now you can run:

show databases;

To see databases you have

drop database databasename;

To delete a database

select * from mysql.user;

To see all of the current mysql users

delete from mysql.user where id = x;

Where x is the id of the user you want to delete, deletes user.

Hope that helps! As alvosu said, reading the documentation is the best place to start.

  • As a note, you're deleting from command line instead of from your web hosting control panel. – Calvin Froedge Jan 30 '11 at 16:20
  • "sudo mysql -p" mysql works better as root? – alvosu Jan 30 '11 at 16:22
  • sudo means run command as root. So you can be logged into server as any other user, but if that user is in the "sudo" list (look in the manual to find the location of this file), then it can run commands as root through sudo. The other alternative is to SU to root. Be careful when you're messing around in the filesystem though, as you can easily do a lot of damage if you start deleting things and you don't know what you're doing. – Calvin Froedge Jan 30 '11 at 16:41
  • Use 'mysql -u root -p'... mysql no need to run as root. – alvosu Jan 30 '11 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.