try to change bin log directory: mysql-bin.index n

2020-05-14 08:38发布

MySQL 5.1.54 Ubuntu 11.04

I'am try to change bin log directory in my.conf as:

[mysqld]
log_bin=/home/developer/logs/mysql/mysql-bin.log

After this changes MySQL server can't start with error:

/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

What's going on?

13条回答
Rolldiameter
2楼-- · 2020-05-14 08:53

You need to give user permissions to the directory as follows:

chown -R mysql:mysql /home/developer/logs/mysql/
查看更多
乱世女痞
3楼-- · 2020-05-14 08:55

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.

查看更多
叛逆
4楼-- · 2020-05-14 09:00

You can also comment the line in my.cnf file which is defining the log location, so mysql will consider its default path and will start properly.

log-bin = /var/log/mysql/mysql-bin.log -> #log-bin = /var/log/mysql/mysql-bin.log.

This will be helpful if you are not concerned much about logs.

查看更多
一纸荒年 Trace。
5楼-- · 2020-05-14 09:02

Does your user have access to all upper directories? In special, the /home/developer/ directory? Try to log in with the mysql server account and touch the log file.

查看更多
姐就是有狂的资本
6楼-- · 2020-05-14 09:03

mysqld: File '/data/log/mysql/mysql-bin.index' not found (Errcode: 2 - No such file or directory)

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.

chown -R mysql:mysql /data/log/mysql/

查看更多
Deceive 欺骗
7楼-- · 2020-05-14 09:03

During replication configuration in "my.cnf" file needs to mention

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/

chmod 777 mysql

this is applicable with MySQL version 5.7

查看更多
登录 后发表回答