0

It is simple to set bin log for mysql in centos,just uncomment the line in /etc/my.cnf. Before uncomment in my.cnf.

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

Uncomment it in my.cnf.

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

No /etc/my.cnf in debian9's mariadb.
1.Add log_bin directory in debian9's mysql.cnf.

sudo vim  /etc/mysql/conf.d/mysql.cnf
log_bin  = /var/log/mysql/mysql-bin.log
sudo touch /var/log/mysql/mysql-bin.log
sudo chown mysql.mysql /var/log/mysql/mysql-bin.log    
sudo systemctl restart  mysql
sudo systemctl status  mysql
● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: 
   Active: active (running) since Thu 2019-05-02 08:16:54 CST; 24s ago

It seems no issue for the setting.

mysql -u root -p
mysql: unknown variable 'log_bin=/var/log/mysql/mysql-bin.log'

2.Add log_bin directory in debian9's 50-server.cnf.

sudo vim  /etc/mysql/mariadb.conf.d/50-server.cnf
log_bin  = /var/log/mysql/mysql-bin.log

Now to restart mysql.

sudo systemctl restart  mysql
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

What's happening?

sudo journalctl -xe
-- 
-- Unit mariadb.service has finished shutting down.
May 02 08:32:26 debian systemd[1]: Starting MariaDB database server...
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit mariadb.service has begun starting up.
May 02 08:32:27 debian mysqld[3640]: 2019-05-02  8:32:27 140494098832768 [Note] 
May 02 08:32:30 debian systemd[1]: mariadb.service: Main process exited, code=ex
May 02 08:32:30 debian systemd[1]: Failed to start MariaDB database server.

How to set bin log for Maradb in debian9?

showkey
  • 85
  • 1
  • 1
  • 14

1 Answers1

0

Test many times on my pc.

sudo apt install mariadb-client mariadb-server can enable bin log,with the same process ,sudo apt install mariadb-server can't enable bin log ,although sudo apt install mariadb-server shall trigger the os install mariadb-client,i don't know why.

showkey
  • 85
  • 1
  • 1
  • 14