I have a simple webserver (Debian 6.0 x86, DirectAdmin with 1 GB of memory and still 10 GB free space, mySQl version 5.5.9), however the mySQL server keeps crashing and I need to kill all mySQL processes to be able to restart it again.
/var/log/mysql-error.log
output:
130210 21:04:26 InnoDB: Using Linux native AIO
130210 21:04:34 InnoDB: Initializing buffer pool, size = 128.0M
130210 21:05:42 InnoDB: Completed initialization of buffer pool
130210 21:05:48 InnoDB: Initializing buffer pool, size = 128.0M
130210 21:06:22 InnoDB: Initializing buffer pool, size = 128.0M
130210 21:06:27 mysqld_safe mysqld from pid file /usr/local/mysql/data/website.pid ended
130210 21:06:29 mysqld_safe mysqld from pid file /usr/local/mysql/data/website.pid ended
130210 21:07:22 InnoDB: Completed initialization of buffer pool
130210 21:07:51 mysqld_safe mysqld from pid file /usr/local/mysql/data/website.pid ended
130210 21:08:33 InnoDB: Completed initialization of buffer pool
130210 21:12:03 [Note] Plugin 'FEDERATED' is disabled.
130210 21:12:47 InnoDB: The InnoDB memory heap is disabled
130210 21:12:47 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
130210 21:12:47 InnoDB: Compressed tables use zlib 1.2.3
130210 21:12:47 InnoDB: Using Linux native AIO
130210 21:13:11 InnoDB: highest supported file format is Barracuda.
130210 21:13:23 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130210 21:14:05 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
130210 21:17:53 InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
130210 21:17:53 InnoDB: Operating system error number 11 in a file operation.
I have found a topic on the mySQL website here however there's no solution for it.
Any ideas anyone?
another approach from one comment in the same blog:
via http://www.webhostingtalk.com/archive/index.php/t-1070293.html
with ubuntu 14.04. I'm experiencing this problem when I try to restart via
Instead try
Solution
make a copy of the original files (ibdata1, ib_logfile0, ib_logfile1...).
http://cglreport.zhenhua.info/2008/08/mysql-error-unable-to-lock-ibdata1.html
The most common cause of this problem is trying to start MySQL when it is already running.
To resolve it, kill off any running instances of MySQL and then restart it using your normal startup scripts, e.g.
service mysql start
.Don't attempt to start MySQL manually when using distribution-packaged versions unless you are prepared for a world of hurt.
This helped me to solve it:
Delete all ibdata files and let mysql create them.
stop mysql:
go to mysql library:
move innodb files somewhere in case you need it:
start mysql:
Check space to make sure it is 100%
As if its full it wont create .sock file.
As other users are reporting, this is usually due to MySQL not being properly terminated upon
systemctl stop mysql.service
.I noticed on Ubuntu 18.04 that filling in the root password twice in
/etc/mysql/debian.cnf
made systemctl stop and start the MySQL server process properly which eliminated the problem.Came here from googling of the same repeating error but with error code 13 (
InnoDB: Unable to lock ./ibdata1, error: 13
). After trying lot of solutions around the internet, invented one that helped me (apparmor!)Add these lines to the config
/etc/apparmor.d/usr.sbin.mysqld
(and reload apparmor and mysql of course):The main differences between often solutions: two rules (for dir itself and for all files inside, note the double
**
) andk
option to allow mysql to lock files.Hope this help someone.
Please check that you have
pid-file
parameter in the[mysql]
section ofmy.cnf
file. If it is not present, theunable to lock ...ibdata1.. error:1
will occur.Simple, but faster than the way with "cp -a". And helped when "cp -a" and everything other couldn't.
service mysql stop && pkill -f mysql
Get rid of all mysql processes
vi /etc/mysql/my.cnf
Change parameter datadir=/var/lib/mysql to datadir=/var/lib/mysql2 (or just add if you don't have)
mv /var/lib/mysql /var/lib/mysql2
Rename datadir to a new name
service mysql start
Prepare your tambourine