mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)

本贴最后更新于 1752 天前,其中的信息可能已经事过景迁

mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)

env:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

/usr/sbin/mysqld  Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)

concluson for those impatient

  1. see your mysql config file
  2. make sure all the configurations in your config file is owned by user mysql && group mysql
  3. if not, just change their ownship and owner group to mysql

progress

  1. view log
    get useful log in file /var/log/mysqld.log like below

    mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
    2020-03-06T08:04:17.833206Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 16352
    2020-03-06T08:04:17.835908Z 0 [ERROR] [MY-010119] [Server] Aborting
    
  2. check my config file
    my config looks like below:

    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
    
    [mysqld]
    #
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    # innodb_buffer_pool_size = 128M
    #
    # Remove the leading "# " to disable binary logging
    # Binary logging captures changes between backups and is enabled by
    # default. It's default setting is log_bin=binlog
    # disable_log_bin
    #
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M
    #
    # Remove leading # to revert to previous value for default_authentication_plugin,
    # this will increase compatibility with older clients. For background, see:
    # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
    default-authentication-plugin=mysql_native_password
    
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    

    throught checking i found:

    ls -al /var/lib/mysql
    total 168068
    drwxr-x---   2 mysql mysql     4096 Mar  6 15:59 #innodb_temp
    drwxr-x--x   6 mysql mysql     4096 Mar  6 16:04 .
    drwxr-xr-x. 30 root  root      4096 Mar  6 13:14 ..
    -rw-r-----   1 mysql mysql       56 Mar  6 13:33 auto.cnf
    -rw-r-----   1 mysql mysql     1167 Mar  6 14:33 binlog.000001
    -rw-r-----   1 mysql mysql      971 Mar  6 14:40 binlog.000002
    -rw-r-----   1 mysql mysql      178 Mar  6 15:27 binlog.000003
    -rw-r-----   1 mysql mysql      199 Mar  6 15:43 binlog.000004
    -rw-r-----   1 mysql mysql      178 Mar  6 15:44 binlog.000005
    -rw-r-----   1 root  root       178 Mar  6 15:45 binlog.000006
    -rw-r-----   1 root  root       178 Mar  6 15:46 binlog.000007
    -rw-r-----   1 root  root       178 Mar  6 15:46 binlog.000008
    -rw-r-----   1 root  root       178 Mar  6 15:47 binlog.000009
    -rw-r-----   1 root  root       178 Mar  6 15:49 binlog.000010
    -rw-r-----   1 root  root       178 Mar  6 15:49 binlog.000011
    -rw-r-----   1 root  root       178 Mar  6 15:49 binlog.000012
    -rw-r-----   1 root  root       178 Mar  6 15:58 binlog.000013
    -rw-r-----   1 root  root       155 Mar  6 15:59 binlog.000014
    -rw-r-----   1 root  root       224 Mar  6 15:59 binlog.index
    -rw-------   1 mysql mysql     1680 Mar  6 13:33 ca-key.pem
    -rw-r--r--   1 mysql mysql     1112 Mar  6 13:33 ca.pem
    -rw-r--r--   1 mysql mysql     1112 Mar  6 13:33 client-cert.pem
    -rw-------   1 mysql mysql     1680 Mar  6 13:33 client-key.pem
    -rw-r-----   1 root  root      3329 Mar  6 15:58 ib_buffer_pool
    -rw-r-----   1 mysql mysql 50331648 Mar  6 15:59 ib_logfile0
    -rw-r-----   1 mysql mysql 50331648 Mar  6 13:33 ib_logfile1
    -rw-r-----   1 mysql mysql 12582912 Mar  6 15:59 ibdata1
    -rw-r-----   1 root  root  12582912 Mar  6 15:59 ibtmp1
    drwxr-x---   2 mysql mysql     4096 Mar  6 13:33 mysql
    -rw-r-----   1 mysql mysql 25165824 Mar  6 15:59 mysql.ibd
    srwxrwxrwx   1 root  root         0 Mar  6 15:59 mysql.sock
    -rw-------   1 root  root         6 Mar  6 15:59 mysql.sock.lock
    drwxr-x---   2 mysql mysql     4096 Mar  6 13:33 performance_schema
    -rw-------   1 mysql mysql     1680 Mar  6 13:33 private_key.pem
    -rw-r--r--   1 mysql mysql      452 Mar  6 13:33 public_key.pem
    -rw-r--r--   1 mysql mysql     1112 Mar  6 13:33 server-cert.pem
    -rw-------   1 mysql mysql     1676 Mar  6 13:33 server-key.pem
    drwxr-x---   2 mysql mysql     4096 Mar  6 13:33 sys
    -rw-r-----   1 mysql mysql 10485760 Mar  6 15:59 undo_001
    -rw-r-----   1 mysql mysql 10485760 Mar  6 15:59 undo_002
    
    
    ls -al /var/run/mysqld/mysqld.pid
    -rw-r----- 1 root root 6 Mar  6 15:59 /var/run/mysqld/mysqld.pid
    
    1. change owner ship and owner group
    chgrp mysql -R /var/lib/mysql
    chown mysql -R /var/run/mysqld
    
    chgrp mysql -R /var/run/mysqld
    chown mysql -R /var/run/mysqld
    
    1. restart mysqld service, and your problem fixed
  • MySQL

    MySQL 是一个关系型数据库管理系统,由瑞典 MySQL AB 公司开发,目前属于 Oracle 公司。MySQL 是最流行的关系型数据库管理系统之一。

    692 引用 • 535 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...