Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does centos7 open mysql log

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This post is about how centos7 opens mysql logs. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.

In the mysql configuration file (/etc/my.cnf) write:

general_log=1

general_log_file=/log/general.log

slow_query_log=1

slow_query_log_file=/log/slowqueries.log

long_query_time=5

log_output='FILE,TABLE'

The above configuration functions are:

general_log=1 Open general log

general_log_file=/usr/local/mysql/mysql-5.7.22/log/general.log

slow_query_log=1 Open slow query log

slow_query_log_file=/usr/local/mysql/mysql-5.7.22/log/slowqueries.log

long_query_time=5 Slow query threshold

log_output='FILE,TABLE' output mode, FILE means file, TABLE means database (you can see the log in mysql library), can be used at the same time, the method above, can also be used alone such as log_output='FILE'. Output to files is more efficient than output to databases.

Note: mysql does not take the initiative to create log files, so you need to add them manually. After adding them, all users are given readable and writable permissions, chmod 777 log files, otherwise they will report permission denied.

Restart mysql after modification: systemctl restart mysqld

Thank you for reading! About centos7 how to open mysql log to share here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge. If you think the article is good, you can share it so that more people can see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report