Script to log MySQL users and persistant connections

Repair a Crashed MySQL Table

In case you stumble across an error like: "Table 'table_name' is marked as crashed and should be repaired" and/or specifically with gallery2 you recieve "ERROR_STORAGE_FAILURE", you'll need to do the following:

If you enable debug in gallery2 ( $gallery->setDebug(true); ), you'll see the above table needing a repair.

Set limits for MySQL usage by Users

To limit a user/database from overloading a MySQL server, the following can be done.

mysql #log into mysql as root
show grants for user@'193.1.99.64/255.255.255.192';
grant usage on dbname.* to user@'193.1.99.64/255.255.255.192' with max_user_connections 5;
show grants for user@'193.1.99.64/255.255.255.192';
grant usage on dbname.* to user@'193.1.99.64/255.255.255.192' with max_user_connections 0;

grant usage on wikidb.* to wikiuser@'localhost' with max_user_connections 5;
show grants for wikiuser@'localhost';
grant usage on kartblog.* to kartblog@'localhost' with max_user_connections 5;
show grants for kartblog@'localhost';
//Not sure what max_user_connections is ideal, but will try it at 5.