Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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