MySQL 5.7 安装错误`mysqld: Can't create/write to file '/var/lib/mysql/is_writable'` [英] MySQL 5.7 installation error `mysqld: Can't create/write to file '/var/lib/mysql/is_writable'`

查看:377
本文介绍了MySQL 5.7 安装错误`mysqld: Can't create/write to file '/var/lib/mysql/is_writable'`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Ubuntu 14.04 上安装 MySQL 5.7.

I am trying to install MySQL 5.7 on Ubuntu 14.04.

以下是我遵循的步骤:

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

除了最后一步之外,所有步骤都运行得很完美.它给了我以下错误:

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

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

以下是错误的完整日志:

Following is the complete log of the error:

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)

有人可以建议我解决该错误吗?提前致谢!

Can someone please suggest me a solution for the error? Thanks in advance!

推荐答案

您需要确保您的数据目录为 mysql 用户所有,并且属于 mysql> 组.我之前在设置 MySQL 时也忘记这样做了.如果你这样做,它应该可以工作:

You need to make sure that your data directory is owned by the mysql user and belongs to the mysql group. I've forgotten to do this before as well when setting up MySQL. It should work if you do:

sudo chown mysql /var/lib/mysql
sudo chgrp mysql /var/lib/mysql

这是 MySQL 文档.

这篇关于MySQL 5.7 安装错误`mysqld: Can't create/write to file '/var/lib/mysql/is_writable'`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆