Posts Tagged ‘mysql’

You have an error in your SQL syntax

I find MySQL’s error messages pretty annoying due to how vague they usually are.
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near blah blah blah at line #
Not helpful.
I was doing a very simple INSERT into a [...]

MySQL’s insert_id AND ON DUPLICATE KEY UPDATE

Discovered today that I was getting the wrong id back when trying to do insert_id() on a MySQL connection that previously ran a INSERT… ON DUPLICATE KEY UPDATE…. The problem is that ordinarily on inserts, LAST_INSERT_ID() returns the auto_increment value that was used in the insert. However, when the query updates instead because a key [...]

Debugging Apache and Mysql

If you’re getting too many MySQL threads or Apache connections, and you would like to debug them, here are two possible ways to get the info you need:
Apache
fullstatus – Displays a full status report from mod_status. For this to work, you need to have mod_status enabled on your server [...]