Mysql

mysql 不啟動:bin 文件上的錯誤 13(權限設置正確)

  • January 13, 2022

我剛剛重命名了主機名並重新啟動了伺服器,現在 mysql 5.6 無法啟動。(debian 7 + dotdeb)

150312 20:40:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql.mnt
2015-03-12 20:40:15 13855 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2015-03-12 20:40:15 13855 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)

^G/usr/sbin/mysqld: File '/var/export/websrvDB.log/websrvDB-bin.index' not found (Errcode: 13 - Permission denied)
2015-03-12 20:40:15 13855 [ERROR] Aborting

2015-03-12 20:40:15 13855 [Note] Binlog end
2015-03-12 20:40:15 13855 [Note] /usr/sbin/mysqld: Shutdown complete

但這沒有意義

/var/export/websrvDB.log 有 mysql:mysql 700 並且那裡的所有文件都有 600 和 mysql:mysql

所有其他所有權看起來也很好,當我打開 binlog 時伺服器啟動。

日誌文件夾中有 134 個文件,有相當多的 GB。.index 文件似乎已正確包含所有這些文件。我也對日誌文件中的 ^G 感到困惑,它每次都會出現。

有誰能幫忙,謝謝。


cd /var/export/websrvDB.log; ls -l

total 134170264
-rw------- 1 mysql mysql        143 Feb 23 19:45 websrvDB-bin.000001
-rw------- 1 mysql mysql      12634 Feb 24 18:21 websrvDB-bin.000002
-rw------- 1 mysql mysql 1087177258 Feb 24 20:23 websrvDB-bin.000003
-rw------- 1 mysql mysql 1121509434 Feb 24 22:44 websrvDB-bin.000004
-rw------- 1 mysql mysql 1186530117 Feb 25 00:18 websrvDB-bin.000005
-rw------- 1 mysql mysql 1091943807 Feb 25 01:38 websrvDB-bin.000006
-rw------- 1 mysql mysql 1082287219 Feb 25 03:17 websrvDB-bin.000007
-rw------- 1 mysql mysql 1098320416 Feb 25 05:00 websrvDB-bin.000008
-rw------- 1 mysql mysql 1081566516 Feb 25 06:42 websrvDB-bin.000009
-rw------- 1 mysql mysql 1076875987 Feb 25 08:25 websrvDB-bin.000010
-rw------- 1 mysql mysql 1095260241 Feb 25 10:11 websrvDB-bin.000011
-rw------- 1 mysql mysql 1115154789 Feb 25 11:49 websrvDB-bin.000012
-rw------- 1 mysql mysql 1160372496 Feb 25 13:42 websrvDB-bin.000013
-rw------- 1 mysql mysql 1154960867 Feb 26 18:37 websrvDB-bin.000014
-rw------- 1 mysql mysql 1179407616 Feb 26 20:23 websrvDB-bin.000015
-rw------- 1 mysql mysql 1076835188 Feb 26 21:58 websrvDB-bin.000016
-rw------- 1 mysql mysql 1119616839 Feb 26 23:37 websrvDB-bin.000017
-rw------- 1 mysql mysql 1090227407 Feb 27 01:06 websrvDB-bin.000018
-rw------- 1 mysql mysql 1175220171 Feb 27 02:49 websrvDB-bin.000019
-rw------- 1 mysql mysql 1127677063 Feb 27 04:19 websrvDB-bin.000020
-rw------- 1 mysql mysql 1098126690 Feb 27 05:55 websrvDB-bin.000021
-rw------- 1 mysql mysql 1134191605 Feb 27 07:25 websrvDB-bin.000022
-rw------- 1 mysql mysql 1122427455 Feb 27 09:09 websrvDB-bin.000023
-rw------- 1 mysql mysql 1135147659 Feb 27 10:45 websrvDB-bin.000024
-rw------- 1 mysql mysql 1125946921 Feb 27 12:31 websrvDB-bin.000025
-rw------- 1 mysql mysql 1092043180 Feb 27 14:19 websrvDB-bin.000026
-rw------- 1 mysql mysql 1075775510 Feb 27 15:58 websrvDB-bin.000027
-rw------- 1 mysql mysql 1128520626 Feb 27 17:47 websrvDB-bin.000028
-rw------- 1 mysql mysql 1091159443 Feb 27 19:22 websrvDB-bin.000029
-rw------- 1 mysql mysql 1112875335 Feb 27 20:53 websrvDB-bin.000030
-rw------- 1 mysql mysql 1082121151 Feb 27 22:23 websrvDB-bin.000031
-rw------- 1 mysql mysql 1152197988 Feb 28 00:04 websrvDB-bin.000032
-rw------- 1 mysql mysql 1129642072 Feb 28 01:35 websrvDB-bin.000033
-rw------- 1 mysql mysql 1109195165 Feb 28 03:14 websrvDB-bin.000034
-rw------- 1 mysql mysql 1159186180 Feb 28 04:53 websrvDB-bin.000035
-rw------- 1 mysql mysql 1148540354 Feb 28 06:26 websrvDB-bin.000036
-rw------- 1 mysql mysql 1112285583 Feb 28 08:01 websrvDB-bin.000037
-rw------- 1 mysql mysql 1124405095 Feb 28 09:44 websrvDB-bin.000038
-rw------- 1 mysql mysql 1086068375 Feb 28 11:29 websrvDB-bin.000039
-rw------- 1 mysql mysql 1074889949 Feb 28 13:16 websrvDB-bin.000040
-rw------- 1 mysql mysql 1110640917 Feb 28 15:05 websrvDB-bin.000041
-rw------- 1 mysql mysql 1097061339 Feb 28 16:55 websrvDB-bin.000042
-rw------- 1 mysql mysql 1091835063 Feb 28 18:29 websrvDB-bin.000043
-rw------- 1 mysql mysql 1123465247 Feb 28 20:09 websrvDB-bin.000044
-rw------- 1 mysql mysql 1120903068 Feb 28 21:49 websrvDB-bin.000045
-rw------- 1 mysql mysql 1104045209 Feb 28 23:23 websrvDB-bin.000046
-rw------- 1 mysql mysql 1075161414 Mar  1 01:07 websrvDB-bin.000047
-rw------- 1 mysql mysql 1079931470 Mar  1 02:51 websrvDB-bin.000048
-rw------- 1 mysql mysql 1089022624 Mar  1 04:33 websrvDB-bin.000049
-rw------- 1 mysql mysql 1109861251 Mar  1 06:26 websrvDB-bin.000050
-rw------- 1 mysql mysql 1083623418 Mar  1 07:58 websrvDB-bin.000051
-rw------- 1 mysql mysql 1076549912 Mar  1 09:29 websrvDB-bin.000052
-rw------- 1 mysql mysql 1116605273 Mar  1 11:13 websrvDB-bin.000053
-rw------- 1 mysql mysql 1075945796 Mar  1 12:46 websrvDB-bin.000054
-rw------- 1 mysql mysql 1083113492 Mar  1 14:22 websrvDB-bin.000055
-rw------- 1 mysql mysql 1133158602 Mar  1 15:56 websrvDB-bin.000056
-rw------- 1 mysql mysql 1077916188 Mar  1 17:37 websrvDB-bin.000057
-rw------- 1 mysql mysql 1090615582 Mar  1 19:10 websrvDB-bin.000058
-rw------- 1 mysql mysql 1139990328 Mar  1 20:53 websrvDB-bin.000059
-rw------- 1 mysql mysql 1134876873 Mar  1 22:40 websrvDB-bin.000060
-rw------- 1 mysql mysql 1083456779 Mar  2 00:12 websrvDB-bin.000061
-rw------- 1 mysql mysql 1122142023 Mar  2 01:55 websrvDB-bin.000062
-rw------- 1 mysql mysql 1186471154 Mar  2 03:43 websrvDB-bin.000063
-rw------- 1 mysql mysql 1127402176 Mar  2 05:17 websrvDB-bin.000064
-rw------- 1 mysql mysql 1125413082 Mar  2 07:05 websrvDB-bin.000065
-rw------- 1 mysql mysql 1099621274 Mar  2 08:39 websrvDB-bin.000066
-rw------- 1 mysql mysql 1089318088 Mar  2 10:13 websrvDB-bin.000067
-rw------- 1 mysql mysql 1133336276 Mar  2 11:52 websrvDB-bin.000068
-rw------- 1 mysql mysql 1084554026 Mar  2 13:31 websrvDB-bin.000069
-rw------- 1 mysql mysql 1095748746 Mar  2 15:13 websrvDB-bin.000070
-rw------- 1 mysql mysql 1086093387 Mar  2 16:50 websrvDB-bin.000071
-rw------- 1 mysql mysql 1097876338 Mar  2 18:36 websrvDB-bin.000072
-rw------- 1 mysql mysql 1107253853 Mar  2 20:16 websrvDB-bin.000073
-rw------- 1 mysql mysql 1074499187 Mar  2 22:08 websrvDB-bin.000074
-rw------- 1 mysql mysql 1108353519 Mar  3 00:03 websrvDB-bin.000075
-rw------- 1 mysql mysql 1089224171 Mar  3 01:25 websrvDB-bin.000076
-rw------- 1 mysql mysql 1159334605 Mar  3 02:56 websrvDB-bin.000077
-rw------- 1 mysql mysql 1142869855 Mar  3 04:30 websrvDB-bin.000078
-rw------- 1 mysql mysql 1109087904 Mar  3 06:20 websrvDB-bin.000079
-rw------- 1 mysql mysql 1091382217 Mar  3 07:57 websrvDB-bin.000080
-rw------- 1 mysql mysql 1081426102 Mar  3 09:29 websrvDB-bin.000081
-rw------- 1 mysql mysql 1083136326 Mar  3 11:15 websrvDB-bin.000082
-rw------- 1 mysql mysql 1114845600 Mar  3 13:00 websrvDB-bin.000083
-rw------- 1 mysql mysql 1088647835 Mar  3 14:45 websrvDB-bin.000084
-rw------- 1 mysql mysql 1086713145 Mar  3 16:35 websrvDB-bin.000085
-rw------- 1 mysql mysql 1106967849 Mar  3 18:27 websrvDB-bin.000086
-rw------- 1 mysql mysql 1085522515 Mar  3 20:07 websrvDB-bin.000087
-rw------- 1 mysql mysql 1109263916 Mar  3 21:59 websrvDB-bin.000088
-rw------- 1 mysql mysql 1119403385 Mar  3 23:49 websrvDB-bin.000089
-rw------- 1 mysql mysql 1124332388 Mar  4 01:37 websrvDB-bin.000090
-rw------- 1 mysql mysql 1103510594 Mar  4 03:23 websrvDB-bin.000091
-rw------- 1 mysql mysql 1094601772 Mar  4 05:17 websrvDB-bin.000092
-rw------- 1 mysql mysql 1076745884 Mar  5 12:24 websrvDB-bin.000093
-rw------- 1 mysql mysql 1162650801 Mar  5 13:33 websrvDB-bin.000094
-rw------- 1 mysql mysql 1132094717 Mar  5 14:46 websrvDB-bin.000095
-rw------- 1 mysql mysql 1088579042 Mar  5 15:43 websrvDB-bin.000096
-rw------- 1 mysql mysql 1087194400 Mar  5 16:35 websrvDB-bin.000097
-rw------- 1 mysql mysql 1101657663 Mar  5 17:25 websrvDB-bin.000098
-rw------- 1 mysql mysql 1106463332 Mar  5 18:05 websrvDB-bin.000099
-rw------- 1 mysql mysql 1115337638 Mar  5 18:44 websrvDB-bin.000100
-rw------- 1 mysql mysql 1089658949 Mar  5 19:17 websrvDB-bin.000101
-rw------- 1 mysql mysql 1076160676 Mar  5 19:50 websrvDB-bin.000102
-rw------- 1 mysql mysql 1092955658 Mar  5 20:25 websrvDB-bin.000103
-rw------- 1 mysql mysql 1084219729 Mar  5 20:59 websrvDB-bin.000104
-rw------- 1 mysql mysql 1113240888 Mar  5 21:28 websrvDB-bin.000105
-rw------- 1 mysql mysql 1074056657 Mar  5 22:06 websrvDB-bin.000106
-rw------- 1 mysql mysql 1074775076 Mar  5 22:40 websrvDB-bin.000107
-rw------- 1 mysql mysql 1128158980 Mar  5 23:17 websrvDB-bin.000108
-rw------- 1 mysql mysql 1092187915 Mar  5 23:48 websrvDB-bin.000109
-rw------- 1 mysql mysql 1078401155 Mar  6 00:25 websrvDB-bin.000110
-rw------- 1 mysql mysql 1102177576 Mar  6 01:00 websrvDB-bin.000111
-rw------- 1 mysql mysql 1087022135 Mar  6 01:36 websrvDB-bin.000112
-rw------- 1 mysql mysql 1082729607 Mar  6 02:17 websrvDB-bin.000113
-rw------- 1 mysql mysql 1080814610 Mar  6 02:55 websrvDB-bin.000114
-rw------- 1 mysql mysql 1078733843 Mar  6 03:35 websrvDB-bin.000115
-rw------- 1 mysql mysql 1076538345 Mar  6 04:15 websrvDB-bin.000116
-rw------- 1 mysql mysql 1074724341 Mar  6 04:57 websrvDB-bin.000117
-rw------- 1 mysql mysql 1079546730 Mar  6 05:39 websrvDB-bin.000118
-rw------- 1 mysql mysql 1080282707 Mar  6 06:26 websrvDB-bin.000119
-rw------- 1 mysql mysql 1074087059 Mar  6 07:12 websrvDB-bin.000120
-rw------- 1 mysql mysql 1077486222 Mar  6 08:02 websrvDB-bin.000121
-rw------- 1 mysql mysql 1075726356 Mar  6 08:51 websrvDB-bin.000122
-rw------- 1 mysql mysql 1076102229 Mar  7 21:37 websrvDB-bin.000123
-rw------- 1 mysql mysql 1077231040 Mar  8 11:40 websrvDB-bin.000124
-rw------- 1 mysql mysql 1077058120 Mar  9 17:22 websrvDB-bin.000125
-rw------- 1 mysql mysql  792830910 Mar 10 17:27 websrvDB-bin.000126
-rw------- 1 mysql mysql  780084400 Mar 12 20:01 websrvDB-bin.000127
-rw------- 1 mysql mysql       6731 Mar 10 17:27 websrvDB-bin.index

cd / var / 導出;ls -l

drwx------ 2 mysql    mysql    12288 Mar 10 17:27 websrvDB.log

我的.cnf

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql.mnt
tmpdir      = /tmp
tmpdir      = /var/lib/mysql.mnt/tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
explicit_defaults_for_timestamp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address       = 127.0.0.1
#
# * Fine Tuning
#
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit   = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
general_log_file        = /var/log/mysql/mysql.log
general_log             = 0
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.

server-id       = 201
log_bin         = /var/export/websrvDB.log/websrvDB-bin
binlog_format       = ROW
binlog_do_db        = websrvDB_pdw
innodb_flush_log_at_trx_commit  = 1
sync_binlog         = 1
binlog_ignore_db    = websrvDB_archive
binlog_ignore_db        = websrvDB_temp
binlog_ignore_db        = websrvDB_userdata

expire_logs_days    = 5
#max_binlog_size         = 100M
#
# basic loggin
log-error       = /var/log/mysql/error.log
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# It seems that we need this for successful mysql-5.1 -> mysql-5.6 upgrade
innodb_data_file_path=ibdata1:10M:autoextend
innodb_file_per_table
innodb_file_format=Barracuda
innodb_buffer_pool_size=2GB
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet  = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer      = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

就個人而言,我對您擁有的權限並不滿意。

由於 mysqld 沒有執行,請嘗試以下操作

cd /var/export/websrvDB.log
mkdir junk
cd junk
mv ../websrvDB-bin.* .
cd ..
service mysql start
ls -l websrvDB-bin.*

mysqld 應該啟動並創建一個新的二進制日誌和索引文件。查看 and 的權限,websrvDB-bin.000001那些websrvDB-bin.index應該是正確的權限。

你也應該這樣做

chmod -R 644 /var/export/websrvDB.log

並嘗試重新啟動 MySQL

我不確定這台伺服器上發生了什麼,但問題與 openVZ 有關。

無論出於何種原因,伺服器決定他不想將 binlog 放在已掛載的文件夾中。仍在努力解決這個問題。

引用自:https://dba.stackexchange.com/questions/95123