Mysql ran out of resources (either Ram or swap file) and died every 2 to 4 days. Turns out is was postfix using up all the memory due to some spammy process. I didn’t need postfix running so I just stopped it and solved the mysql issue.
Posts Categorized: mySQL
Trying to import a Magento table into a database (drop table if exists) I got an error: The way to get round this is to remove the foreign key constraint CHECK, delete the table, then add the check again:
Taken from here
Thought this was a neat way of testing/handling query errors without assigning the result to a variable because you don’t need a variable unless you are using SELECT. mysql_error() returns empty string if there was no error, which evaluates to false, as pointed out by jakub-arnold in this post
There are times when you need to get an SQL dump of a database but you don’t have access to management tools AND system(), exec() and passthru() commands are disabled. This script from David Walsh will do the trick:
SELECT table_schema “database name”, sum( data_length + index_length ) / 1024 / 1024 “Database size in MB” FROM information_schema.TABLES GROUP BY table_schema;