MySQL5.7新特性之错误日志打印到操作系统日志文件

 通常,MySQL将错误日志输出在hostname.err文件中,但MySQL5.7可以将错误日志打印到操作系统日志中,具体操作如下:
 MySQL服务器启动的时候,mysqld_safe加 --syslog参数,如下:
 启动MySQL服务:
[root@mysql log]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --syslog --user=mysql &
[1] 17994
[root@mysql log]# 2017-07-21T04:05:12.802731Z mysqld_safe Logging to syslog.
2017-07-21T04:05:12.807548Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-07-21T04:05:12.828189Z mysqld_safe Starting mysqld daemon with databases from /mysql/data
[root@mysql log]# 

查看系统日志:
[root@mysql log]# tail -f /var/log/messages
Jul 21 12:05:14 mysql mysqld[18451]: Server hostname (bind-address): '*'; port: 3306
Jul 21 12:05:14 mysql mysqld[18451]: IPv6 is available.
Jul 21 12:05:14 mysql mysqld[18451]:   - '::' resolves to '::';
Jul 21 12:05:14 mysql mysqld[18451]: Server socket created on IP: '::'.
Jul 21 12:05:14 mysql mysqld[18451]: Event Scheduler: Loaded 0 events
Jul 21 12:05:14 mysql mysqld[18451]: /usr/local/mysql/bin/mysqld: ready for connections.#012Version: '5.7.18-log'  socket: '/tmp/mysqld.sock'  port: 3306  Source distribution
Jul 21 12:05:14 mysql mysqld[18451]: Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check. 
Jul 21 12:05:14 mysql mysqld[18451]: Beginning of list of non-natively partitioned tables
Jul 21 12:05:14 mysql mysqld[18451]: End of list of non-natively partitioned tables
Jul 21 12:05:14 mysql mysqld[18451]: InnoDB: Buffer pool(s) load completed at 170721 12:05:14

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30135314/viewspace-2144573/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30135314/viewspace-2144573/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值