1.mysql错误日志
1.错误日志默认是关闭的
2.默认路径是 $datadir/,默认的名字是'主机名.err'
3.配置方式(一般场景所有配置)
[root@db02 ~]# vim /etc/my.cnf
[mysqld]
server_id=1
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
socket=/tmp/mysql.sock
skip-name-resolve
log_err=/usr/local/mysql/data/mysql.err
[mysql]
socket=/tmp/mysql.sock
4.查看方式
[root@db02 ~]# mysql -e "show variables like '%log_err%'"
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| log_error | /usr/local/mysql/data/mysql.err |
+---------------------+---------------------------------+
2.一般查询日志
1.查看方式
mysql> show variables like '%general%';
+------------------+--------------------------------+
| Variable_name | Value |
+------------------+--------------------------------+
| general_log | OFF |
| general_log_file | /usr/local/mysql/data/db02.log |
+------------------+--------------------------------+
2 rows in set (0.00 sec)
2.默认是关闭的
3.默认路径是 $datadir/,默认的名字是'主机名.log'
4.配置方式
[root@db02 ~]# vim /etc/my.cnf
[mysqld]
log_err=/usr/local/mysql/data/mysql.err
general_log=on
general_log_file=/usr/local/mysql/data/db02.log
[mysql]
socket=/tmp/mysql.sock
3.二进制日志
#注意:
1)binlog生成默认大小是120
2)binlog的大小也是binlog的当前位置点
1.查看方式
mysql> show variables like '%log_bin%';
2.二进制日志默认是关闭的
3.配置binlog
[root@db02 ~]# vim /etc/my.cnf
[mysqld]
server_id #mysql5.7必须配置server_id
log_bin=/usr/local/mysql/data/mysql-bin #mysql5.7只支持下划线
#log-bin=/usr/local/mysql/data/mysql-bin #mysql5.6都支持
4.二进制配置路径和名字由配置文件决定,一般保存在$datadir/ 以'mysql-bin.000001'命令