Another little bit which I am missing (as a beginner) I have a Backup script between two DB and as a final step I should optimise the real DB to reduce the size of the overhead. I have a code which works when I use only one DB but I need to use two:
$actconn = mysql_connect($dbhost, $actdbuser, $actdbpass) or die ('act Error connecting to mysql');
$bckconn = mysql_connect($dbhost, $bckdbuser, $bckdbpass) or die (' back Error connecting to mysql');
$ressql="SHOW TABLE STATUS FROM $actdbname WHERE Data_free / Data_length > 0.1 AND Data_free > 102400";
- this should tell that bckuser is ignored, I believe...
$res = mysql_query( $ressql, $actconn);
echo mysql_error();
while($optrow = mysql_fetch_assoc($res)) {
mysql_query('OPTIMIZE TABLE ' . $optrow['Name'], $actconn);
}
actconn value: Resource id #1
bckconn value: Resource id #2
mysql_error says:
SELECT command denied to user 'bckuser'@'localhost' for table 'actual table'
any idea what I do wrong?
UPDATE: bckuser should not do anything with it as actdbuser is the root of that DB, but some reason SHOW TABLE won't recognise $actconn...
UPDATE2:
I tried just the opt again and the only thing is changed is the $actdbname='db-name'; when working and $actdbname='db-name
' with the spec apostrophe;
please note this is on sharedhost so I can't change the DB name.
thanks @Corbin interesting idea, I tried and didn't work, but how could I debug it? I can't even debug it properly some reason...