Category Archives: Mysql

MySQL – Using 100% of CPU

MySQL – Using 100% of CPU

If you have a php based website take a look at the php.ini and see if the following is on or off:

; Allow or prevent persistent links.
mysql.allow_persistent = Off
If it is ON, turn it off and restart apache and mysql. It will most likely resolve the issue.

Post to Twitter

InnoDB: Unable to lock ./ibdata1, error: 11


Today, I saw that our mysql server suddenly went down and on checking mysql server logs,

following thing was noticed.


InnoDB: Unable to lock /path/to/ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.

To fix this issue, make a copy of the original files (ibdata1, ib_logfile0, ib_logfile1…).

mv /var/lib/mysql/ibdata1 /var/lib/mysql/ibdata1.bak

cp -a /var/lib/mysql/ibdata1.bak /var/lib/mysql/ibdata1

Now start mysql service.

/etc/init.d/mysql start

Post to Twitter

mysql :Got error: 1016: Can’t open file: … (errno: 24) when using LOCK TABLES


Sometimes, when you have got a large number of tables in your database and while taking the dump of that particular database, you would have encountered this strange error.

 mysqldump: Got error: 1016: Can’t open file: ‘.\database\certain_table.frm’ (errno: 24) when using LOCK TABLES


There are two solutions for this problem.

1) Set the following value to some higher number in your my.cnf file.


2) or, While taking the mysql dump, use –lock-tables=false option.

mysqldump –lock-tables=false -u root -p db-with-lots-of-tables  >  databasename.sql

Post to Twitter

MySQLCouldn’t find MySQL manager

Restarting mysql was giving following error

[root@server]# /etc/init.d/mysql restart

MySQL manager or server PID file could not be found! [FAILED] Starting MySQLCouldn't find MySQL manager (/var/lib/bin/mysql) or server (/var/lib/bin/mysqld_safe)
Comment out or remove the basedir directive from /etc/my.cnf file 

[mysql.server ]

Then restart mysql

That's all :)

Post to Twitter


Downgrade mysql on cpanel

By default cPanel installs Mysql 5. If for some reason you wish to downgrade mysql then you will need to follow following steps.

1) If you already have database on server, then you will need to take backup of them in the format of .sql for simply
copy/var/lib/mysql to /var/lib/mysql-bak . If server is newly setup then no worries.

cp -r /var/lib/mysql /var/lib/mysql-bak

2) Editing cPanel configuration file.

nano /var/cpanel/cpanel.config

and replace mysql-version=5.0 with mysql-version=4.1

3) Forcefully installing Mysql 4

/scripts/mysqlup – -force

4) Above process will take some time. Once this is done check mysql version.

mysql -V

Above command should show you mysql version 4 if every thins is correctly done.

5) Now recompile php so that mysql 4 gets compitable with php version as well.


Post to Twitter