ubuntu 16 setup mariadb 10.0(a.k.a.mysql) log-error

来源:互联网 发布:淘宝聚便宜 编辑:程序博客网 时间:2024/06/10 04:02

OS: ubuntu16.04
mariadb 其实就是mysql, 只不过mysql被oracle收购,为防止oracle闭源,所以mysql社区外延出了mariadb。
之前一直修改my.cnf,但没什么效果,后来改动mariadb.cnf,成功指定log-error路径文件

安装
DEBIAN_FRONTEND=noninteractive + -y : 无交互安装

  • apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -V –no-install-recommends mariadb-server

文件路径

  • mysql dir: /etc/mysql/
  • data dir: /var/lib/mysql
  • log dir: /var/log/mysql

设置error log
mariadb.cnf 是my.cnf的最终link结果, 所以我们直接修改mariadb.cnf

  • /etc/mysql/my.cnf -> /etc/alternatives/my.cnf-> /etc/mysql/mariadb.cnf
    这里写图片描述

mariadb.cnf

default

# The MariaDB configuration file## The MariaDB/MySQL tools read configuration files in the following order:# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,# 2. "/etc/mysql/conf.d/*.cnf" to set global options.# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.# 4. "~/.my.cnf" to set user-specific options.## If the same option is defined multiple times, the last one will apply.## 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.## This group is read both both by the client and the server# use it for options that affect everything#[client-server]# Import all .cnf files from configuration directory!includedir /etc/mysql/conf.d/!includedir /etc/mysql/mariadb.conf.d/

add code

[mysqld_safe]log_error=/var/log/mysql/mysql_error.log[mysqld]log_error=/var/log/mysql/mysql_error.log

http://www.pontikis.net/blog/how-and-when-to-enable-mysql-logs