Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve InnoDB: Unable to lock ./ibdata1 mysql error?

Tags:

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.

like image 328
Wojtek Dmyszewicz Avatar asked Mar 14 '16 01:03

Wojtek Dmyszewicz


People also ask

Can I delete ibdata1 file in MySQL?

The ibdata1 file can be shrinked if you delete all databases, remove the files and reload the mysqldump. We can configure MySQL so that each table, including its indexes, is stored as a separate file. It is enabled by default as of version 5.6.

What is ibdata1 file in MySQL?

The file ibdata1 is the system tablespace for the InnoDB infrastructure. It contains several classes for information vital for InnoDB. Table Data Pages. Table Index Pages. Data Dictionary.

What happens if I delete ibdata1?

ibdata1 contains InnoDB dictionary which is vitally important for InnoDB. If you delete it any access to a table will fail with Table doesn't exist error. Show activity on this post. if innodb_file_per_table is enabled then the tables can be restored via this and this.


2 Answers

First, list MySQL processes using the ps command:

ps aux | grep mysql 

enter image description here

And then kill the process

sudo kill 56311 
like image 127
Wojtek Dmyszewicz Avatar answered Dec 12 '22 09:12

Wojtek Dmyszewicz


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.

like image 30
fevangelou Avatar answered Dec 12 '22 11:12

fevangelou