LinuxQuestions.org
Help answer threads with 0 replies.
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 01-26-2008, 11:28 AM   #1
nileshgr
Member
 
Registered: Aug 2007
Location: Pune, Maharashtra, India
Distribution: Gentoo
Posts: 84

Rep: Reputation: 16
Tutorial: Setting up MySQL quotas for users (MyISAM)


Ok, it was me only who asked this question. Now I have found a solution to this.

Let the default MySQL datadir be /var/lib/mysql

Suppose you have a user foo on the system as well as on MySQL. Now how to limit space for foo ?

create a separate directory for databases in foo's home say /home/foo/dbs with ownership mysql:foo and permissions 3755.

Now move all foo's databases from /var/lib/mysql to /home/foo/dbs

Then create symbolic links to the database named folders.

Example there is one foo's db called db1 in /var/lib/mysql/db1

Code:
# mkdir /home/foo/dbs
# mv /var/lib/mysql/db1 /home/foo/dbs/
# chown mysql:foo /home/foo -Rf
# chmod 3755 -Rf /home/foo
# ln -s /var/lib/mysql/db1 /home/foo/dbs/db1 -v
NOTE- I AM NOT RESPONSIBLE FOR ANY DAMAGES OCCURRED & TO TEST THIS TRY RESTARTING mysqld.

if mysqld starts OK then its working else it isn't.
 
Old 01-29-2008, 02:56 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Why mess with all the symlinks. Setup your mysql to use /home/mysql or something of the like for it's base database directory. Then just chown each database for each owner, the quota will take affect on the /home partition. No need for creating a bunch of symlinks, etc.
 
Old 02-02-2008, 08:46 PM   #3
nileshgr
Member
 
Registered: Aug 2007
Location: Pune, Maharashtra, India
Distribution: Gentoo
Posts: 84

Original Poster
Rep: Reputation: 16
if more tables are added ? they won't go on the name of the db owner
 
Old 02-03-2008, 09:10 PM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by nilesh.3892 View Post
if more tables are added ? they won't go on the name of the db owner
I guess you never heard of sticky bit then..
 
Old 02-04-2008, 06:37 AM   #5
nileshgr
Member
 
Registered: Aug 2007
Location: Pune, Maharashtra, India
Distribution: Gentoo
Posts: 84

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by trickykid View Post
I guess you never heard of sticky bit then..
no i have. from wikipedia. but i prefer this method. but now i am thinking of creating a C program using the features of MySQL C API, quotactl(2)
 
  


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
PHP-MySQL tutorial and Linux Networking tutorial needed Please dlux45 Linux - Software 6 04-19-2010 01:10 PM
F7-i386: MySQL Quotas nileshgr Linux - Server 2 01-23-2008 08:16 PM
Quotas: Setting them Swakoo Linux - Newbie 1 10-27-2005 07:59 AM
Setting Up Filesystem Quotas j_miguel_y Linux - Software 0 06-09-2004 10:21 AM
Setting up User Quotas? Uncreative Slackware 3 05-11-2003 08:08 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration