Friday 10 July 2009

Finally got MySQL working

This morning I tried installing MySQL 5.4.1 on my web server, in the hopes that it would work with the Innobase (InnoDB) plugin, unlike MySQL 5.4.0.

Well, it installed okay, and I could start mysqld_safe okay, but when I tried to set the root password with mysqladmin, I got the error
mysqladmin: connect to server at 'localhost' failed
error: 'Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug'


I stopped mysqld, edited the InnoDB settings in the my.cnf file to use less memory, deleted the InnoDB log files, and then started mysqld_safe again, but this time got an error about the database being corrupt.

So I deleted the mysql data directory, installed the base database (mysql_install_db) again, then started mysqld again. But then I found I couldn't do anything, I kept getting an error
-bash: fork: Resource temporarily unavailable
Problem was, because I couldn't start any new processes, I couldn't get the pid of any running processes and kill them.

So I raised a ticket with WebFaction, and they killed some processes for me. I realised that running Apache (I had 6 httpd processes running), NginX, spawn-fcgi (4 processes), mysqld_safe and mysqld was using far too much memory, as I only have 80MB available to me on the plan I'm using.

The apache processes were set to try and start if not already running every 20 minutes, so I had to edit my crontab, comment out that line, then stop apache. I edited the mysql my.cnf file again, and made the memory for innodb even lower:
# Set buffer pool size to 50-80% of your computer's memory
innodb_buffer_pool_size=10M
innodb_additional_mem_pool_size=4M
#
# Set the log file size to about 25% of the buffer pool size
innodb_log_file_size=3M
innodb_log_buffer_size=1M


mysqld_safe would now start okay, and the innobase plugin would load, however checking the mysql log I see
090710 5:56:58 [Warning] option 'innodb-buffer-pool-size': signed value 10485760 adjusted to 67108864
090710 5:56:58 [Warning] option 'innodb-log-file-size': signed value 3145728 adjusted to 33554432
090710 5:56:58 [Warning] option 'innodb-log-buffer-size': signed value 1048576 adjusted to 2097152


So I don't know if the minimum innodb-buffer-pool-size is 64MB, minimum innodb-log-file-size is 32MB and minimum innodb_log_buffer_size is 2MB?

In the evening I watched 'Mississippi', a WC Fields and Bing Crosby film. Quite boring really, was mainly just Bing Crosby singing. I also got some stuff ready for going on holiday with Clare, Ben, and Brian tomorrow.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Ham with sliced vine tomato and iceberg lettuce sandwich; Caramel Rocky; cup o' tea.
Dinner: Battered fish portion; mashed potato; peas; black pepper; vinegar. Pudding was a couple of slices of malt loaf with butter.

No comments: