cancel
Showing results for 
Search instead for 
Did you mean: 

Sql database path

Marteknet
Grafter
Posts: 577
Registered: 13-10-2007

Sql database path

Can anyone tell me how to find the path to my SQL database, what server is it on ?
I am trying to write a script to return the space used by all the tables in my database I think I can do it by using table describe commands in SQL and then parse the results. but that would be very slow and would also place needless load on the server. Far better to use the du command, if only I can work out what path to use.

The results will be posted in a script I am working on to calculate total web space usage, cgi, web, SQL maybe FrontPage if required.

Thanks in advance (fingers crossed) :-)
7 REPLIES
N/A

Sql database path

doesnt it tell you how much you are using in phpMyAdmin? I dont have my password at the moment so i cant log in to find out Sad
If you can't get at it from the admin and you find out a way to do it let us know martek! Smiley

Jarv
Marteknet
Grafter
Posts: 577
Registered: 13-10-2007

Sql database path

You are right it indeed does say usage in mysqladmin, but you seem to have missed the point. I was asking if anyone had knowledge of the path to the actual database files. I can the use du command in the script to read the file sizes.

The whole point being, if I can script this then the question of how much webspace is being used at any time becomes much easier to answer. Its got to be better then looking things up in several different places and then adding the lot together to get the total.

I have about 12 or so tables on my SQL database and looking at each one in turn to see just how much space they are using takes time. Surely with the wonders of modern technology this should be a simple and easy task. But alas I can't seem to find the info on force9 about where the SQL database is held.
N/A

Sql database path

The database is held on a seperate server, which you have no access to other than through the mysql command-line program on the CGI platform, or through your scripts.
Marteknet
Grafter
Posts: 577
Registered: 13-10-2007

Sql database path

ok thanks for the info.

I will take a look for a way to do it faster than via mysql table describe commands and then parse the results for the amount each table uses at that way would be a tad on the slow side.
Pity really as there really ought to be a way to tell what the usage is apart from having to go to mysqladmin and manually look at each and every table in turn.

Any ideas anyone ?
N/A

Sql database path

SHOW TABLE STATUS
and Sum the Data_length and Index_length fields, looks to be the only way...
Marteknet
Grafter
Posts: 577
Registered: 13-10-2007

Sql database path

Cheers Colin.
Thats why I was looking to do this by the DU command. But it seems I will have to go about it the long way round and accesss the info via mysql. Pity really as this puts a needless drain on server resources. But what the heck I will go for it.
Ta Peter.
N/A

Sql database path

Yes i did miss the point a bit, but phpMyAdmin does show you the entrie database usage if you click on the database name.

Why is SHOW TABLE STATUS such a needless drain?

Jarv