14                    

down votefavorite                    
6                    

2016-03-14 02:30:29 58150 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35 2016-03-14 02:30:29 58150 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.                            

       

2 Answers   正确答案  (我重启了一下服务器就好了,不必杀死进程)                

activeoldestvotes                    
       
up vote49down voteaccepted                    

First, list MySQL processes using the ps command:

ps aux | grep mysql
                       

enter image description here                        

And then kill the process

sudo kill 56311          

  •     

       
up vote1down vote                    

Believe it or not, the solution is elsewhere. The problem stems from AppArmor misconfiguration apparently.

So just do:

$ apt install apparmor-profiles
                       

and then restart MySQL (notice how fast it'll restart).

I noticed a file missing related to AppArmor when doing:

$ systemctl status mysql.service
                       

Voila.


  • That solved the issue, just as a side note in case some one else is having the same problem; apparmor errors are reported on syslog at mysql startup. Errors look like this: audit: type=1400 audit(1490314801.743:24): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/sbin/mysqld" pid=21133 comm="apparmor_parser" – Chepech Mar 15 at 5:24                                                    
       

来自  https://stackoverflow.com/questions/35978228/how-to-solve-innodb-unable-to-lock-ibdata1-mysql-error            


       

我重启了一下服务器就好了,不必杀死进程

mysql 无法启动 看到下面的日志信息  有人说 #  ps -ef | grep mysql 看看,有没有关于mysql的信息,如果有的话,就杀死相应的进程,我没有杀死相应的进程,只是重启了一下服务器就好了

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.

181017  5:15:09  InnoDB: Unable to open the first data file

InnoDB: Error in opening ./ibdata1

181017  5:15:09  InnoDB: Operating system error number 11 in a file operation.

InnoDB: Error number 11 means 'Resource temporarily unavailable'.

InnoDB: Some operating system error numbers are described at

InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html

181017  5:15:09 InnoDB: Could not open or create data files.

181017  5:15:09 InnoDB: If you tried to add new data files, and it failed here,

181017  5:15:09 InnoDB: you should now edit innodb_data_file_path in my.cnf back

181017  5:15:09 InnoDB: to what it was, and remove the new ibdata files InnoDB created

181017  5:15:09 InnoDB: in this failed attempt. InnoDB only wrote those files full of

181017  5:15:09 InnoDB: zeros, but did not yet use them in any way. But be careful: do not

181017  5:15:09 InnoDB: remove old data files which contain your precious data!

181017  5:15:09 [ERROR] Plugin 'InnoDB' init function returned error.

181017  5:15:09 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

181017  5:15:09 [ERROR] Unknown/unsupported storage engine: InnoDB

181017  5:15:09 [ERROR] Aborting


           

181017  5:15:09 [Note] /www/wdlinux/mysql-5.5.54/bin/mysqld: Shutdown complete

我重启了一下服务器就好了,不必杀死进程

           


           

         

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

 While trying to start MySQL server  (using /etc/init.d/mysql start), I got the following error,141024 14:43:40 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data141024 14:43:40 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.141024 14:43:40 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.141024 14:43:40 [Note] Plugin 'FEDERATED' is disabled.141024 14:43:40 InnoDB: The InnoDB memory heap is disabled141024 14:43:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins141024 14:43:40 InnoDB: Compressed tables use zlib 1.2.3141024 14:43:40 InnoDB: Using Linux native AIO141024 14:43:40 InnoDB: Initializing buffer pool, size = 8.0G141024 14:43:41 InnoDB: Completed initialization of buffer poolInnoDB: Unable to lock ./ibdata1, error: 11InnoDB: Check that you do not already have another mysqld processInnoDB: using the same InnoDB data or log files.141024 14:43:41  InnoDB: Retrying to lock the first data fileInnoDB: Unable to lock ./ibdata1, error: 11InnoDB: Check that you do not already have another mysqld processInnoDB: using the same InnoDB data or log files.------------------InnoDB: Unable to lock ./ibdata1, error: 11InnoDB: Check that you do not already have another mysqld processInnoDB: using the same InnoDB data or log files.InnoDB: Unable to lock ./ibdata1, error: 11InnoDB: Check that you do not already have another mysqld processInnoDB: using the same InnoDB data or log files.141024 14:45:21  InnoDB: Unable to open the first data fileInnoDB: Error in opening ./ibdata1141024 14:45:21  InnoDB: Operating system error number 11 in a file operation.InnoDB: Error number 11 means 'Resource temporarily unavailable'.InnoDB: Some operating system error numbers are described atInnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html141024 14:45:21 InnoDB: Could not open or create data files.141024 14:45:21 InnoDB: If you tried to add new data files, and it failed here,141024 14:45:21 InnoDB: you should now edit innodb_data_file_path in my.cnf back141024 14:45:21 InnoDB: to what it was, and remove the new ibdata files InnoDB created141024 14:45:21 InnoDB: in this failed attempt. InnoDB only wrote those files full of141024 14:45:21 InnoDB: zeros, but did not yet use them in any way. But be careful: do not141024 14:45:21 InnoDB: remove old data files which contain your precious data!141024 14:45:21 [ERROR] Plugin 'InnoDB' init function returned error.141024 14:45:21 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.141024 14:45:21 [ERROR] Unknown/unsupported storage engine: InnoDB141024 14:45:21 [ERROR] Aborting141024 14:45:21 [Note] /opt/bitnami/mysql/bin/mysqld.bin: Shutdown complete

From the error log it is found that already there is an MySQL running in the same server with same port.You can check the current running MySQL by,

ps –ef | grep mysql


root@localhost:/opt/bitnami/mysql/data# ps -ef | grep mysqlroot     25478 20976  0 14:25 pts/2    00:00:00 /opt/bitnami/mysql/bin/mysql.bin --defaults-file=/opt/bitnami/mysql/my.cnf -u dba –proot     25555     1  0 14:26 ?        00:00:00 /bin/sh /opt/bitnami/mysql/scripts/ctl.sh startroot     25557 25555  0 14:26 ?        00:00:00 /bin/sh /opt/bitnami/mysql/bin/mysqld_safe --defaults-file=/opt/bitnami/mysql/my.cnf --port=3306 --socket=/opt/bitnami/mysql/tmp/mysql.sock --datadir=/opt/bitnami/mysql/data --log-error=/opt/bitnami/mysql/data/mysqld.log --pid-file=/opt/bitnami/mysql/data/mysqld.pid --lower-case-table-names=1mysql    25929 25557  1 14:26 ?        00:00:00 /opt/bitnami/mysql/bin/mysqld.bin --defaults-file=/opt/bitnami/mysql/my.cnf --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-dir=/opt/bitnami/mysql/lib/plugin --user=mysql --lower-case-table-names=1 --log-error=/opt/bitnami/mysql/data/mysqld.log --pid-file=/opt/bitnami/mysql/data/mysqld.pid --socket=/opt/bitnami/mysql/tmp/mysql.sock --port=3306

root     25979 20976  0 14:27 pts/2    00:00:00 /bin/sh /etc/init.d/mysql restart

root     26025 25979  0 14:27 pts/2    00:00:00 /bin/sh /etc/init.d/mysql start

root     26038 26025  1 14:27 pts/2    00:00:00 /bin/sh /opt/bitnami/mysql/bin/mysqld_safe --datadir=/opt/bitnami/mysql/data --pid-file=/opt/bitnami/mysql/data/ip-172-31-59-38.pidmysql    26345 26038 38 14:27 pts/2    00:00:00 /opt/bitnami/mysql/bin/mysqld.bin --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-dir=/opt/bitnami/mysql/lib/plugin --user=mysql --log-error=/opt/bitnami/mysql/data/ip-172-31-59-38.err --pid-file=/opt/bitnami/mysql/data/ip-172-31-59-38.pid --socket=/opt/bitnami/mysql/tmp/mysql.sock --port=3306root     26349 22899  0 14:27 pts/0    00:00:00 grep --color=auto mysql      


我重启了一下服务器就好了,不必杀死进程

      

Here you could see there are two MySQL running’s with same base and data directories. But the error log path is mentioned different for both.It was due to a script which made mysql to start automatically if MySQL is not running.Solved by  killing all the running MySQL process and removed the script .Then made MySQL to start it started without error

我重启了一下服务器就好了,不必杀死进程

           


           

来自  https://mysqldb-info.blogspot.com/2014/11/innodb-unable-to-lock-ibdata1-error-11_24.html