Results 1 to 5 of 5
Hi,
Lets say I have a server with apache/mysql installed and I want to lend out some database space to someone, but I don't want this someone to see my ...
- 12-20-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 19
MySql server multiple islolated users
Hi,
Lets say I have a server with apache/mysql installed and I want to lend out some database space to someone, but I don't want this someone to see my databases and he don't want to see mine. How can I have multiple users on a single mysql instance that are totally isolated?
Scripts such as phpmyadmin allow any user to view any database, it needs to appear as if they are the only user.
- 12-20-2009 #2
Create one user or one set of users for your databases
and other users for the other databases.
Do not give the DB root account to anyone.
That includes phpmyadmin (If one needs that thing, (s)he shouldn't have access to critical databases anyhow. But that's just a personal opinion
)
By restricting users to certain DBs, they cannot see or use what is in the other DBs.
The most a regular DB user can do is a "show databases", so the names of your DBs would be revealed.Last edited by Irithori; 12-20-2009 at 12:04 PM.
You must always face the curtain with a bow.
- 12-20-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 19
How will I go about doing this.
I added a new user in phpmyadmin and assigned it a database-same-as-name (or something like that), but this user can still view the other DBs
- 12-20-2009 #4
Example:
Connect to mysqld as root.
CREATE database database_A;
CREATE database database_B;
GRANT ALL ON database_A.* TO 'user_A'@'localhost';
GRANT ALL ON database_B.* TO 'user_B'@'localhost';
FLUSH PRIVILEGES;
Then user_A (coming from localhost)only has access to database_A, but not database_B.
And vice versa.
The GRANT statement will also create the users.
If you use it on already existing users,
verify their privileges in DB mysql, tables "user" and "db".
For more detailed information look here:
MySQL :: MySQL 5.1 Reference Manual :: 12.5.1.3 GRANT SyntaxLast edited by Irithori; 12-20-2009 at 07:32 PM.
You must always face the curtain with a bow.
- 12-21-2009 #5Just Joined!
- Join Date
- Mar 2009
- Posts
- 19
Worked a treat, thanks


Reply With Quote