mysqlfedoramaster-slave

MySQL not starting up after added log-bin - Master Replication


I trying to set up master replication server. When I try to start/restart the server after added log-bin directory as following in my.cnf,

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

the server is not starting up.

MySQL status

mysqld.service - MySQL Server Loaded: loaded (/etc/systemd/system/mysqld.service; enabled) Active: inactive (dead) since Mon, 13 Jul 2015 17:46:47 +0800; 1s ago Process: 14145 ExecStart=/usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock (code=exited, status=0/SUCCESS) CGroup: name=systemd:/system/mysqld.service

But after I changed the log-bin as following (without folder path)

log-bin = mysql-bin.log

the server is running successfully.

MySQL status

mysqld.service - MySQL Server Loaded: loaded (/etc/systemd/system/mysqld.service; enabled) Active: active (running) since Mon, 13 Jul 2015 17:47:43 +0800; 2s ago Main PID: 15272 (mysqld_safe) CGroup: name=systemd:/system/mysqld.service ├ 15272 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysq... └ 15615 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/...

Update

From mysqld.log :

/var/log/mysql/mysql-bin.index' not found (Errcode: 2)

But my mysql-bin.index by default at

/var/lib/mysql/mysql-bin.index

Could anyone please help me out as I just start to learn master-slave replication? Do I need to create a folder name mysql and change the permission to mysql and put in log directory or how I can make sure it locates my mysql-bin.index file correctly?


Solution

  • Finally I have found the solution. Not sure whether I did it in a right way.

    After searched about (Errcode: 2), found that it is indicate that the file or directory does not exist. So I have created the folder named as mysql and added in log directory (Logged in as root user). When I try to restart the server, it gives me another error:

    /var/log/mysql/mysql-bin.index' not found (Errcode: 13)

    Errcode: 13 indicates permission denied. So I have change the ownership from root to mysql :

    chown -R mysql:mysql /var/log/mysql
    

    I restart the server and it runs successfully.