Saturday, March 01, 2008

MySQL optimisation

I found a nice MySQL tuner at mysqltuner.com
After using it to find out where there were issues, all I needed to do was alter the my.cnf file in /etc/mysql/

I added the following definitions and saw a significant improvement in efficiency.
#
# * Personal additions JBJ
#
set-variable = thread_cache_size=4M
set-variable = join_buffer_size=128K
set-variable = table_cache=512
set-variable = key_buffer_size=64M

log-slow-queries = /var/log/mysql/mysql-slow.log
long-query_time=1

innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M

Adding mysql admin user

Needed to add an admin to the mysql db and couldn't remember how:
Log in with admin credentials from a root login
sudo -s
mysql -uadmin -p`cat /etc/psa/.psa.shadow`
Then:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;