LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-21-2004, 02:46 PM   #1
dmedici
Member
 
Registered: Aug 2003
Posts: 57

Rep: Reputation: 15
MySQL - command - create user/single database


Greetings!

Using MySQL - looking for the command that lets me create a user and give it access to a single database.
 
Old 06-21-2004, 02:56 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You can use the SQL:
grant all on DATABASE.* to USER@HOST identified by 'PASSWORD';
 
Old 06-21-2004, 03:01 PM   #3
Kintar
LQ Newbie
 
Registered: Sep 2003
Distribution: RedHat 9
Posts: 8

Rep: Reputation: 0
Lightbulb Simlple enough...

First of all, the MySQL documentation is available here. Just click the "Documentation" option. I strongly suggest using the "Searchable - With user comments" area.

For a direct answer to your question, though, you can use the GRANT command. GRANT will create a user if one does not exist. So, to grant access to the database "foo" for user "userman" with password "itsme", you would issue this command:

GRANT ALL PRIVILEGES ON foo.* TO 'userman'@'%' IDENTIFIED BY 'itsme';

This will let that user do anything they like to the database. If you need more restrictive permissions, go take a look at the documentation.

-- Kintar
 
Old 06-21-2004, 03:17 PM   #4
dmedici
Member
 
Registered: Aug 2003
Posts: 57

Original Poster
Rep: Reputation: 15
Thanks guys for your help!

I am checking the documentation now but would also like your recommendations:

I am going to grant all priviledges to at least one user, but to add to my previous question, what do I not want to give an additional user so that I have maximum security and it can still be used as an internet website backend?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Umount single MySQL database KimVette Linux - Software 2 07-13-2005 12:55 PM
creat MySQL database for each user ? Data-Base SUSE / openSUSE 3 03-07-2005 02:42 PM
How to create Database in mysql irfanhab Linux - General 1 12-16-2004 06:37 PM
mysql cannot create a user nocturnal Linux - Software 1 07-05-2003 10:52 AM
query DNS and create mysql database nabil Programming 0 01-18-2002 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration