Last week, I installed XAMPP on a brand new Windows 2008 server, with the sole purpose of running production servers with PHP and MySQL.

One of the websites I copied over, was a WordPress CMS. I imported the database and made the user credentials. All good.

Then I tried going to this wordpress website, and I received a lovely ERROR 500. Nothing was showing in the error log, nor the access logs. I was completely mystified.

Then, when looking at the user credentials for MySQL, I noticed a difference between the ‘pma’ user and the ‘wordpress’ user – the ‘wordpress’ user had a wildcard (as to expect a connection from any machine) which effectively broke the server, outputting an error that explained nothing.

I’ve posted this in case anybody else has the same problem. Triple check your user permissions for connecting to MySQL.

(I blame Windows for being ghey)

Tags: , , , , , , , ,

· · · ◊ ◊ ◊ · · ·

In the past, I’ve worked with a large table for ‘transactions’ (with way over 800 million rows) – I’ve found that things tend to break on large volumes of clients trying to things such as INSERT (the disk keeps doing weird stuff like doing an earlier INSERT before an older one, leading to memory problems and bottlenecks).

I learned a small trick, and that is to use INSERT DELAYED

When a client uses INSERT DELAYED, it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread.

By using this, it will not slow the database down by much, but it will free the database to write the INSERTs to disk at any time, so it can bundle a bunch of inserts together – this will stop any weird behavior in your MySQL database, in turn making it faster than it was previously (no memory problems, having to restart all the time and no more large bottlenecks).

Another thing to watch out is using MySQLs time functions like, CURRENT_TIMESTAMP or CUR_DATE() because they will be called everytime the query is executed so you should make sure any time data is generated by your programming language (like PHP) rather than by the database.

This sort of practice would be used for something that records/logs all transactions in a virtual economy, or logging all user events etc.

Tags: , , , , ,

· · · ◊ ◊ ◊ · · ·