How to create new database and user with Phpmyadmin

Hi

I need to create a mysql database, and I only have access to phpmyadmin (No cpanel).

I assume I can use Msql queries to create a database with phpmyadmin.

Please give me the queries that I need to run.  I need the commands to do the things I usually do in cpanel, specifically:

1)  Create the mysql database
2)  Create a user
3)  Assign the user to the database
4)  Give the user all permissions

Thanks!

Rowby
LVL 9
Rowby GorenAsked:
Who is Participating?
 
Greg AlexanderConnect With a Mentor Lead DeveloperCommented:
This should do it:

CREATE database DB_NAME;
GRANT ALL ON DB_NAME.* to username@localhost identified by 'password';
0
 
Rowby GorenAuthor Commented:
Thanks,

I see some choices in the phpmyadmin panel.  Here's some copy and paste:   Do I need to be concerned aobut the characterset  (appears that UTF-8 Unicode is the default).

I also see the connection as  "collation".  I assume that will be handled in some default way.

Otherwise I am ready to run your command -- once I get your comments on this comment.

Rowby

    Server version: 5.0.77-log
    Protocol version: 10
    Server: Localhost via UNIX socket
    User: blahbalht@localhost
    MySQL charset: UTF-8 Unicode (utf8)
    MySQL connection collation: Documentation
0
 
Rowby GorenAuthor Commented:
Also do I need to put quotes around "database", which I assume is the name I want to give to the database.

CREATE database DB_NAME;
GRANT ALL ON DB_NAME.* to username@localhost identified by 'password';
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Greg AlexanderLead DeveloperCommented:
Once you create the database, you will be able to change things around, if you run the commands as I posted into the SQL tab, it will work as is
0
 
Rowby GorenAuthor Commented:
Good.  Thanks. I'll run the command now....

0
 
Rowby GorenAuthor Commented:
WOrked fine!

Now I have to rename the database to a more specific name.

What would be the command to rename the database.

Thanks!

Rowby
0
 
Greg AlexanderLead DeveloperCommented:
RENAME DB_NAME TO WHATEVER_YOU_WANT;
0
 
Rowby GorenAuthor Commented:
Will the user assigned to that renamed database stay assigned to that database.

I assume the user will remain assigned

Rowby
0
 
Mohamed AbowardaConnect With a Mentor Software EngineerCommented:
Yes, the user will remain assigned to the database no matter what is the database name even after you change it.

This following SQL NON-Query will be helpful to you:
grant usage on *.* to username@localhost identified by 'PutTheUserPasswordHere';
grant all privileges on DatabaseNameHere.* to username@localhost;

Open in new window


You can take a look here too:
http://www.abbeyworkshop.com/howto/lamp/my_createdb/index.html
0
 
Greg AlexanderLead DeveloperCommented:
That all work for ya?
0
 
Rowby GorenAuthor Commented:
Yes.  Thanks! Sorry for delay in awarding points.

...Rowby
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.