MySQL 5.7 installation error `mysqld: Can't create/write to file '/var/lib/mysql/is_writable'`
<p>I am trying to install MySQL 5.7 on Ubuntu 14.04.</p>

<p>Following are the steps I followed:</p>

<pre><code>rm -rf /var/lib/mysql
mkdir -p /var/lib/mysql
cd
wget http://dev.mysql.com/get/mysql-apt-config_0.7.2-1_all.deb
dpkg -i mysql-apt-config_0.7.2-1_all.deb
apt-get update
apt-get -y install mysql-server
</code></pre>

<p>All the steps run perfectly except for the last one. It gives me the following error:</p>

<pre><code>mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2016-05-10T02:10:24.219279Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2016-05-10T02:10:24.219530Z 0 [ERROR] Aborting
</code></pre>

<p>Following is the complete log of the error:</p>

<pre><code>Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apparmor libaio1 libapparmor-perl libapparmor1 libmecab2 mysql-client
  mysql-common mysql-community-client mysql-community-server psmisc
Suggested packages:
  apparmor-profiles apparmor-docs apparmor-utils
The following NEW packages will be installed:
  apparmor libaio1 libapparmor-perl libapparmor1 libmecab2 mysql-client
  mysql-common mysql-community-client mysql-community-server mysql-server
  psmisc
0 upgraded, 11 newly installed, 0 to remove and 2 not upgraded.
Need to get 27.8 MB of archives.
After this operation, 215 MB of additional disk space will be used.
Get:1 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-common amd64 5.7.12-1ubuntu14.04 [261 kB]
Get:2 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-community-client amd64 5.7.12-1ubuntu14.04 [7307 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6364 B]
Get:4 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-client amd64 5.7.12-1ubuntu14.04 [12.4 kB]
Get:5 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-community-server amd64 5.7.12-1ubuntu14.04 [19.5 MB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libapparmor1 amd64 2.8.95~2430-0ubuntu5.3 [25.5 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libapparmor-perl amd64 2.8.95~2430-0ubuntu5.3 [26.8 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ trusty-updates/main apparmor amd64 2.8.95~2430-0ubuntu5.3 [319 kB]
Get:9 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-server amd64 5.7.12-1ubuntu14.04 [12.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ trusty/main psmisc amd64 22.20-1ubuntu2 [53.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ trusty/universe libmecab2 amd64 0.996-1.1 [244 kB]
Fetched 27.8 MB in 0s (35.1 MB/s)
Preconfiguring packages ...
Selecting previously unselected package libaio1:amd64.
(Reading database ... 21277 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-common (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../mysql-community-client_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-client (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../mysql-client_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-client (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package libapparmor1:amd64.
Preparing to unpack .../libapparmor1_2.8.95~2430-0ubuntu5.3_amd64.deb ...
Unpacking libapparmor1:amd64 (2.8.95~2430-0ubuntu5.3) ...
Selecting previously unselected package libapparmor-perl.
Preparing to unpack .../libapparmor-perl_2.8.95~2430-0ubuntu5.3_amd64.deb ...
Unpacking libapparmor-perl (2.8.95~2430-0ubuntu5.3) ...
Selecting previously unselected package apparmor.
Preparing to unpack .../apparmor_2.8.95~2430-0ubuntu5.3_amd64.deb ...
Unpacking apparmor (2.8.95~2430-0ubuntu5.3) ...
Selecting previously unselected package psmisc.
Preparing to unpack .../psmisc_22.20-1ubuntu2_amd64.deb ...
Unpacking psmisc (22.20-1ubuntu2) ...
Selecting previously unselected package libmecab2.
Preparing to unpack .../libmecab2_0.996-1.1_amd64.deb ...
Unpacking libmecab2 (0.996-1.1) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../mysql-community-server_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-server (5.7.12-1ubuntu14.04) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.12-1ubuntu14.04_amd64.deb ...
Unpacking mysql-server (5.7.12-1ubuntu14.04) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Setting up mysql-common (5.7.12-1ubuntu14.04) ...
Setting up mysql-community-client (5.7.12-1ubuntu14.04) ...
Setting up mysql-client (5.7.12-1ubuntu14.04) ...
Setting up libapparmor1:amd64 (2.8.95~2430-0ubuntu5.3) ...
Setting up libapparmor-perl (2.8.95~2430-0ubuntu5.3) ...
Setting up apparmor (2.8.95~2430-0ubuntu5.3) ...
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: policy-rc.d denied execution of reload.
Setting up psmisc (22.20-1ubuntu2) ...
Setting up libmecab2 (0.996-1.1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-community-server (5.7.12-1ubuntu14.04) ...
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2016-05-10T02:10:24.219279Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2016-05-10T02:10:24.219530Z 0 [ERROR] Aborting

dpkg: error processing package mysql-community-server (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.12-1ubuntu14.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code></pre>

<p>Can someone please suggest me a solution for the error?
Thanks in advance!</p>