• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

MySQL Database limit possible ?

PaulP

New Member
Hi all,

I really could use your help here...

Searched Google....
I could not find a way to limit the MySQL database per user.
For example: database of user will maximum be 50MB

I have seen an article where CPanel is capable of doing that, but I do not have CPanel.

Is there any other way to perform this limit ?

Please let me know.

Kind regards,
PaulP.
 
Hi stuffradio,

Thanks but I think I already found out. MySQL does not support limitations like that.

So it has to be resolved in another way.
I do have a few things I could test.

Otherwise I will leave it like this..... I was just wondering.

Kind regards,
PaulP.
 
PHP:
<?
function getDbSize( $database )
{
	$return = null ;
	if( !@mysql_select_db( $database ) ):
		die("Cannot select $database");
	elseif( !($result = mysql_query( "SHOW TABLE STATUS" )) ):
		die( "Cannot query $database" );
	else:
		while( $data= mysql_fetch_array( $result ) ) $return += ( $data["Data_length"] + $data["Index_length"] );
	endif;
	return $return < 1024000 ? round( $return / 1024, 1 ) . "k" : round( $return / 1024000, 1) . "MB" ;
}
echo getDbSize( "database_name" );
?>
 
Hi KRAK_JOE,

Thanks you very much for the script, I will test it tomorrow and let you know !

:applaudin

PaulP.
 
oh man, lol, that's only half of what I meant to write, what I meant to say was, using something like that to check database sizes you can write a script to loop through the users databases but without knowing which cp you're using more I cannot say .....
 
LOL !

You know what... I think that I will start learning PHP.
I do have the time now and everywhere I see more and more PHP scripts as solutions to my questions.

I am aware of all the PHP learning sites on the Internet but I rather have a study book. I will buy them and study !

KRAK_JOE, you are a PHP Programmer, any recommendations what resources/books to look at ?

Kind regards,
PaulP.
 
in the past when people have asked me that, I have said I got no idea, but recently, my partner, a 20 year old bank cashier succesfully taught herself the ( very ) basics of php with just one book in less than 10 days aswell as managing her fulltime job by day and our 2 year old daughter by night, that book was php5 for dummies, she just read a bit every night, ( till she was bored I guess ) she can't really do anything usefull but she didnt want to she just wanted to understand the terminology that is used around her so much, so my recommendation to learn the basics would be that.

However, my objective opinion would have to be; a book that is written by one or two people isn't a brilliant learning tool, once you have grasped not only the basics of how to write a script but where and when to use php, I would study php.net for as long as possible, literally page by page, even if you think you won't use it or it bores the hell out of you. Although non intentional, that's basically what's happened to me, I have attempted to answer everyones questions wherever I can, and as you know always with php, you look at it for long enough and it'll become like a second language.
 
Back
Top