MySQLログ出力設定について - CentOS|Systems Engineer Wiki

Systems Engineer Wiki

訪問者:23,215,213 人目

<< 2021年12月 

1234
567891011
12131415161718
19202122232425
262728293031
お知らせ・メンテナンス情報
  >  
  >  
MySQLログ出力設定について

MySQLログ出力設定について

投稿日:2015-01-27 17:45:29

MySQLログ出力設定について

MySQLログ出力設定について MySQLのインストール時の初期設定では、QueryログやErrorログが出力されないため設定を変更してQueryログやErrorログが出力されるようにしてみました。 今回は下記のログファイルを出力するように設定を書き換えました。

# vi /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # QueryLog log=/var/log/mysql/mysql-query.log # ErrorLog log-error=/var/log/musql/mysql-error.log log-warnings=1 # SlowLog log-slow-queries=/var/log/mysql/mysql-slow.log long-query-time=1 log-queries-not-using-indexes log-slow-admin-statements # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used (fedora >= 15). # If you need to run mysqld under a different user or group, # customize your systemd unit file for mysqld according to the # instructions in http://fedoraproject.org/wiki/Systemd user=mysql # Semisynchronous Replication # http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html # uncomment next line on MASTER ;plugin-load=rpl_semi_sync_master=semisync_master.so # uncomment next line on SLAVE ;plugin-load=rpl_semi_sync_slave=semisync_slave.so # Others options for Semisynchronous Replication ;rpl_semi_sync_master_enabled=1 ;rpl_semi_sync_master_timeout=10 ;rpl_semi_sync_slave_enabled=1 # http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html ;performance_schema [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

MySQLの設定ファイルを変更したので、サービスの再起動を行います。

# /etc/init.d/mysqld restart