LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-07-2012, 01:21 PM   #1
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Rep: Reputation: 15
How do I set mysql perms for user created DB's?


Using OpenSusE 11.4, this is what I want to do:-

new user is created using webmin with auto create mysql user.
user logs in using SSH (on none standard port)
at the user prompt is typed mysql -p
user enters password
if show databases; is typed user can not see any other DB except his own, if no user DB then user only sees blank list, and can not even see the system DB's

user types create database <name>;
then user can only see the DB just created, and no other.
user can then edit the newly created DB, or even use drop database <name>; or create more but ONLY see and edit those that the user created, regardless of the name used to create the DB.

Is this possible to perform automatically, whenever a new user is created.
 
Old 02-08-2012, 02:42 PM   #2
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 39
Sorry if I misunderstood your question so let me rephrase it. You craeted one user accunt using webmin. Now when the user logs in using SSH and run the MySQL command with -p he gets logged in mysql.
Now you want him to see only those databases that he created and he can modify/delete those databases only?

For the above, the solution is mysql GRANT command on those databases for that particular user and host from which he will connect.You have to login as root user in MySQL to issue GRANT commands.
 
Old 02-08-2012, 08:40 PM   #3
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
No, you didn't misunderstand, that is precisely how I wanted it, but using GRANT, a DB has to have been created in the first place to grant that user the right perms, but I need to have the perms so that even if the user hasn't yet created a DB, he/she only sees an empty list when using 'show databases;' and when he/she creates the first DB (regardless of what name the user chooses for the DB) and then subsequent DB's, he/she can only see those that were created by that user, and if that user has created only 1 DB, and then uses 'drop database <name>;' which would result in an empty list when viewed, much like when a hosting company allows creation of DB's.

If it is possible, how would it be done?, I know enough mysql to create, drop, show, etc etc, but 'granting' is a bit more advanced.

Last edited by Usalabs; 02-08-2012 at 08:46 PM.
 
  


Reply



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
Created mysql user but access denied locally littlened Linux - Server 1 09-19-2011 04:55 AM
[SOLVED] Can't set Admin and user passwords for Mysql-5.0.37 NightSky Slackware 4 11-23-2008 05:15 PM
how to set the new user created right as admins in linux 7.3 ? melvinong Linux - Server 2 04-15-2008 07:45 AM
root can access a partition and see owners/groups/perms, user gets question marks lurko Debian 2 10-05-2006 11:30 AM
set perms when mounting vfat? spiderworm Linux - General 1 11-19-2003 05:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:33 PM.

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