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 have a VPS, and am having troubles with MySQL. I think I have created a database, but got lost.

I need to know how to:

  • Add a database, with the username, name of the database, and password.

  • Remove a database.

share|improve this question
    
could you please throw more light into this? Say what you tried? What is the problem your are facing? Kindly update with more information –  ZVIK Oct 28 '13 at 4:15
    
Have you tried searching for how to do this and learning through online resources? –  Drew Khoury Oct 28 '13 at 8:28

1 Answer 1

up vote 0 down vote accepted

if you are using mysql from the command line, you would connect to your mysql server with
mysql -u USER -p PASS

if that works you're at a mysql prompt >
type CREATE DATABASE my_new_database_name;
Then use a GRANT statement to create a new user with access only to that database; eg
GRANT ALL PRIVILEGES ON my_new_database_name.* TO 'new_user_name'@'%' IDENTIFIED BY 'new_password';
GRANT ALL PRIVILEGES ON my_new_database_name.* TO 'new_user_name'@'localhost' IDENTIFIED BY 'new_password';

You can see what databases you have with:
show databases;
and you can delete a database with DROP DATABASE my_new_database_name;

share|improve this answer

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.