尝试更改 bin 日志目录:找不到 mysql-bin.index (Errcode: 13)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7660410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
try to change bin log directory: mysql-bin.index not found (Errcode: 13)
提问by solo117
MySQL 5.1.54 Ubuntu 11.04
MySQL 5.1.54 Ubuntu 11.04
I'am try to change bin log directory in my.conf as:
我尝试将 my.conf 中的 bin 日志目录更改为:
[mysqld]
log_bin=/home/developer/logs/mysql/mysql-bin.log
After this changes MySQL server can't start with error:
更改后 MySQL 服务器无法启动并出现错误:
/usr/sbin/mysqld: File '/home/developer/logs/mysql/mysql-bin.index'
not found (Errcode: 13)
111005 12:47:58 [ERROR] Aborting
Permission for directory /home/developer/logs/mysql/ is 0777
目录 /home/developer/logs/mysql/ 的权限为 0777
What's going on?
这是怎么回事?
回答by solo117
As usual, the solution was simple but not obvious: it needed to edit apparmor settings I just added to /etc/apparmor.d/usr.sbin.mysqlda new string with path to target directory: /home/developer/logs/* rw
像往常一样,解决方案很简单但并不明显:它需要编辑我刚刚添加到/etc/apparmor.d/usr.sbin.mysqld的apparmor 设置一个带有目标目录路径的新字符串:/home/developer/logs/*权重
It works!
有用!
回答by Pradeep Jadhav
/usr/sbin/mysqld: File '/usr/binlogs/mysql-bin.index' not found (Errcode: 13)
/usr/sbin/mysqld:找不到文件“/usr/binlogs/mysql-bin.index”(错误代码:13)
It worked for me with:
它对我有用:
chown -R mysql:mysql /usr/binlogs/
chown -R mysql:mysql /usr/binlogs/
回答by Halfstop
Just as an FYI for anyone who runs into a similar problem, the solution is basically the same, but the cause of the problem isn't obvious.
就像遇到类似问题的任何人的仅供参考,解决方案基本相同,但问题的原因并不明显。
After upgrading Debian wheezy, mysql failed to start.
升级Debian wheezy后,mysql启动失败。
Somehow, I have no idea how, permissions on some of the files in /var/lib/mysql
were not owned by the mysql user, thus preventing the server from firing up.
不知何故,我不知道如何,/var/lib/mysql
mysql 用户不拥有某些文件的权限,从而阻止服务器启动。
A chown -R mysql.mysql /var/lib/mysql
fixed it.
一个chown -R mysql.mysql /var/lib/mysql
固定它。
I didn't do anything to mess up mysql, it was a standard:
我没有做任何事情来搞乱 mysql,这是一个标准:
apt-get update
apt-get upgrade
Something got hinky during the Debian upgrade and manual intervention was needed.
在 Debian 升级过程中出现了一些问题,需要手动干预。
回答by Jeeva
Option 1:
选项1:
service mysqld stop
Copy the log files including the .index file to new location.
cp mysql-bin.log* /path/to/binlogs cp mysql-bin.index /path/to/binlogs
Do Changes in the
/etc/my.cnf
file.[mysqld] log-bin=/path/to/newdirecory/mysql-bin log-bin-index=/path/to/newdirectory/mysql-bin.index
service mysqld start
service mysqld stop
将包含 .index 文件的日志文件复制到新位置。
cp mysql-bin.log* /path/to/binlogs cp mysql-bin.index /path/to/binlogs
在
/etc/my.cnf
文件中进行更改。[mysqld] log-bin=/path/to/newdirecory/mysql-bin log-bin-index=/path/to/newdirectory/mysql-bin.index
service mysqld start
Option 2:
选项 2:
Use this utiltiy to relocate binary logs:
使用此实用程序重新定位二进制日志:
mysqlbinlogmove --binlog-dir=/server/data /new/binlog_dir
回答by Jim Ockers
Selinux might enforce the rule that MySQL database files have to live in /var/lib/mysql and not anywhere else. Try turning off selinux (selinux=0 on kernel boot command line) if you moved mysql to another directory.
Selinux 可能会强制执行 MySQL 数据库文件必须位于 /var/lib/mysql 而不是其他任何地方的规则。如果您将 mysql 移动到另一个目录,请尝试关闭 selinux(内核引导命令行上的 selinux=0)。
回答by Sujit Devkar
You need to give user permissions to the directory as follows:
您需要授予用户对该目录的权限,如下所示:
chown -R mysql:mysql /home/developer/logs/mysql/
回答by Vaisakh PS
mysqld: File '/data/log/mysql/mysql-bin.index' not found (Errcode: 2 - No such file or directory)
mysqld:找不到文件“/data/log/mysql/mysql-bin.index”(错误代码:2 - 没有这样的文件或目录)
I was really stuck in the middle of my MySQL Master - Slave setup. Finally the above was a permission issue, adding the below command solved my issue.
我真的被困在我的 MySQL Master - Slave 设置中间。最后,上面是一个权限问题,添加下面的命令解决了我的问题。
chown -R mysql:mysql /data/log/mysql/
chown -R mysql:mysql /data/log/mysql/
回答by Felipe Villalobos
As documentation in mysql say https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_bin
作为 mysql 中的文档说https://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_bin
The variable is log_bin and not log-bin at least in version 5.7
变量是 log_bin 而不是 log-bin 至少在 5.7 版中
回答by user2648582
Your config is wrong:
你的配置有问题:
log_bin=/home/developer/logs/mysql/mysql-bin.log
You would use instead
你会用
log-bin=/home/developer/logs/mysql/mysql-bin.log
回答by Samrendra
During replication configuration in "my.cnf" file needs to mention
在“my.cnf”文件中复制配置时需要提及
server-id=1 log_bin=/var/log/mysql/mysql-bin.log
server-id=1 log_bin=/var/log/mysql/mysql-bin.log
you can make your own directory and give permission. create directory "mysql" in /var/log/
您可以创建自己的目录并授予权限。在 /var/log/ 中创建目录“mysql”
chmod 777 mysql
chmod 777 mysql
this is applicable with MySQL version 5.7
这适用于 MySQL 5.7 版