?
Solved

How to create new database and user with Phpmyadmin

Posted on 2011-04-27
11
Medium Priority
?
293 Views
Last Modified: 2013-12-12
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
0
Comment
Question by:Rowby Goren
  • 6
  • 4
11 Comments
 
LVL 19

Accepted Solution

by:
Greg Alexander earned 1700 total points
ID: 35479238
This should do it:

CREATE database DB_NAME;
GRANT ALL ON DB_NAME.* to username@localhost identified by 'password';
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 35479304
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
 
LVL 9

Author Comment

by:Rowby Goren
ID: 35479332
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 19

Expert Comment

by:Greg Alexander
ID: 35479364
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
 
LVL 9

Author Comment

by:Rowby Goren
ID: 35479419
Good.  Thanks. I'll run the command now....

0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 35479485
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
 
LVL 19

Expert Comment

by:Greg Alexander
ID: 35479497
RENAME DB_NAME TO WHATEVER_YOU_WANT;
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 35479561
Will the user assigned to that renamed database stay assigned to that database.

I assume the user will remain assigned

Rowby
0
 
LVL 12

Assisted Solution

by:Mohamed Abowarda
Mohamed Abowarda earned 300 total points
ID: 35480020
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
 
LVL 19

Expert Comment

by:Greg Alexander
ID: 35495487
That all work for ya?
0
 
LVL 9

Author Closing Comment

by:Rowby Goren
ID: 35495660
Yes.  Thanks! Sorry for delay in awarding points.

...Rowby
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question