Optimize MySQL on a Large Database Server

On a large server which run primarily MySQL service only, the first step you should take is to copy the proper config file which is already optimized for large systems:

$ mv /etc/my.cnf/my.cnf_OLD
$ cp /usr/share/doc/mysql-server-5.0.44/my-huge.cnf /etc/my.cnf

I’m using 5.0.44 version here on a CentOS 5.2 box. You need to adjust path as per your mysql version.

Next, find out which database engines you are NOT using, you should disable them in config file. For example,let’s say all of our tables are in MyISAM format only, so we can safely disable InnoDB and BDB engines, add following statements in the [mysqld] section of /etc/my.cnf file:

Ignore mysql error while executing bulk statements

Sometimes when running MySQL in batch mode, it requires to ignore some MySQL errors which pops in between.

As an example, we can consider a scenario where thousands of inserts required to be done and the statements are saved in a file, suppose in indata.sql. But it may be the case that some records are already there in database which you’re trying to insert or you are importing large data for development/test purpose and you won’t bother much if some rows can be skipped. In normal case, MySQL will show error something like below and exit:

ERROR 1062 (23000) at line 6: Duplicate entry 'blablabla' for key 2

Optimize and fix Mysql Server, running slow without any load

I got stuck in a weird problem yesterday, where a newly installed MySQL Server was responding slow. I’ve fixed the issue after detecting a small spelling mistake in file which is entirely not related to MySQL at first instance. Here are some tips, if you’re also on the same boat where Server itself doesnt showing any error, but your user’s lodging complaints of being slow.

1. Check MySQL Configurations: