mysql 无法写文件_MySQL 5.7安装错误`mysqld:无法创建/写入文件’/ var / lib / mysql / is_writable’...

我想在Ubuntu 14.04上安装MySQL 5.7.

以下是我遵循的步骤:

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

除最后一步外,所有步骤都完美无缺.它给了我以下错误:

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

以下是错误的完整日志:

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)

有人可以建议我一个错误的解决方案吗?

提前致谢!

最佳答案:

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

sudo chown mysql /var/lib/mysql

sudo chgrp mysql /var/lib/mysql

标签:mysql

来源: https://codeday.me/bug/20190516/1115554.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值