Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 28th, 2004, 03:22 AM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
Hide mysql database from other users

Hi:

Does anyone know how to make MySQL be like a virtual hosting database? For example, say a user named "John Doe" signed up, and usename is "jdoe". All his databases would be created like "jdoe_databasename". My question is, how can I have it so that he can add as many databases that have jdoe_ prefix, and the ONLY databases he sees is the ones with jdoe_ in front of them? He should see NO OTHER databases. Is this possible? Thanks for your help!!!

Ken Cooper

Reply With Quote
  #2  
Old March 28th, 2004, 06:52 PM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
RE: Hide mysql database from other users

I'm sorry for asking, but I really searched the internet, and couldn't find ANYTHING of how to do this. Does anyone have a clue of how to do this? I hope so. Thanks a lot!!

Reply With Quote
  #3  
Old March 28th, 2004, 08:40 PM
brut brut is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 367 brut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 30 sec
Reputation Power: 2
RE: Hide mysql database from other users

I'm somewhat curious as to your need to do this.
Typically if a user needs a database, you(the admin) creates a database, and a user with full access to that, and only that, database. I've never used it, but I believe phpMyAdmin has user account management functionality to make this task fairly quick and easy.
If someone really needed full access to the server, you could consider running multiple instances of mysql.

Reply With Quote
  #4  
Old March 29th, 2004, 01:06 AM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
RE: Hide mysql database from other users

It's for virtual hosting.

Reply With Quote
  #5  
Old March 31st, 2004, 02:03 AM
bluephoenix's Avatar
bluephoenix bluephoenix is offline
Levelheaded Curmudgeon
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Syracuse, NY
Posts: 507 bluephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 2 sec
Reputation Power: 2
Send a message via AIM to bluephoenix
RE: Hide mysql database from other users

In MySQL you create the database, and then give the user permissions to it using GRANT.

Virtual hosting shouldn't really make a difference. You're the administrator; the user will only have access to the database you assign him.

-Tim



Reply With Quote
  #6  
Old April 1st, 2004, 09:31 AM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
RE: Hide mysql database from other users

Hi:

Thanks for that information! My question is though, in phpMyAdmin, where it shows the database list on the left, how can I limit those databases to the ones that he creates? I would use the GRANT option. Could I please see an example of that? Ok, so I create a database, and it's the user's, but how does the user go about creating more, with:

username_dbname?

Thanks for your help!!

Ken Cooper

Reply With Quote
  #7  
Old April 2nd, 2004, 12:01 PM
bluephoenix's Avatar
bluephoenix bluephoenix is offline
Levelheaded Curmudgeon
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Syracuse, NY
Posts: 507 bluephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 2 sec
Reputation Power: 2
Send a message via AIM to bluephoenix
RE: Hide mysql database from other users

Simply put, the user doesn't create databases; that would be your job as the system administrator. Here's an example:

I've got a web server set for virtual hosting... domainA, domainB and domainC, each domain requires a database:

mysql> CREATE DATABASE domainA;
mysql> CREATE DATABASE domainB;
mysql> CREATE DATABASE domainC;

But one domain shouldn't see the database of another domain.

mysql> GRANT ALL ON domainA.* TO domainAuser@localhost IDENTIFIED BY "passwordA";
mysql> GRANT ALL ON domainB.* TO domainBuser@localhost IDENTIFIED BY "passwordB";
mysql> GRANT ALL ON domainC.* TO domainCuser@localhost IDENTIFIED BY "passwordC";

Then give the user his user id and password that corresponds to the correct database. Each can then create as many tables needed within the database to suit their needs.

mysql> USE domainC;
mysql> CREATE TABLE forum (post_id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, parent_id INTEGER UNSIGNED, time_stamp TIMESTAMP(12), topic VARCHAR(120) NOT NULL, author_id INTEGER UNSIGNED NOT NULL, post TEXT);
mysql> CREATE TABLE users (user_id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY, user_name VARCHAR(50));
mysql> CREATE TABLE user_info (user_name VARCHAR(50) PRIMARY KEY, first_name VARCHAR(100) NOT NULL, last_name VARCHAR(100), location VARCHAR(100), email VARCHAR(225));
mysql> CREATE TABLE user_auth (user_id VARCHAR(50) NOT NULL PRIMARY KEY, passwd VARCHAR(255));
mysql> ...

... and forget about mysqlAdmin for now. Sure a graphical interface is nice, but you'll need to learn the basics first. Then when you know what's going on and how things are done, you can start using admin programs to make things easier for yourself.

-Tim

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Hide mysql database from other users


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT