大网数据广告活动
服务器运维问答

How to view mariadb log?

· 52CE 我爱测

I am using new relic to monitor the performance of my server. Recently I noticed a very strange problem where for every 3 hours, the server will be down for 1 minute. And in the new relic report, during the server down time, ther…

问题原文

原帖链接 · dev-jim · CC BY-SA 3.0

I am using new relic to monitor the performance of my server. Recently I noticed a very strange problem where for every 3 hours, the server will be down for 1 minute. And in the new relic report, during the server down time, there were sudden spike on the database.

The problem is I am new in system admin, I don't know how to view the database log. I am using Mariadb on a Ubuntu 14.04 machine. So, where can I find the log? I tried to view in /var/log/mysql.err, /var/log/mysql.log and /var/log/mysql/error.log there are no content inside.

I also tried grep 'mysql' /var/log/syslog, nothing found as well.

Do I need to enable the logging in mariadb config file? If so, how?

社区高分解答

原帖链接 · Slawomir · CC BY-SA 4.0

On systemd linuxes (Ubuntu), it's centralized under systemd which collects and manages kernel and user-land process logs under the journal. To view mariadb journal, run:

# journalctl -u mariadb -f

You should see something along the lines of:

-- Logs begin at Mon 2021-08-30 08:59:29 CDT. --
Aug 25 21:10:22 aorus-15g-yb mysqld[1123]: 2022-08-25 21:10:22 0 [Note] /usr/sbin/mysqld (mysqld 10.3.34-MariaDB-0ubuntu0.20.04.1) starting as process 1123 ...
Aug 25 21:10:22 aorus-15g-yb systemd[1]: Started MariaDB 10.3.34 database server.
Aug 25 21:10:22 aorus-15g-yb /etc/mysql/debian-start[1254]: Looking for 'mysql' as: /usr/bin/mysql
Aug 25 21:10:22 aorus-15g-yb /etc/mysql/debian-start[1254]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Aug 25 21:10:22 aorus-15g-yb /etc/mysql/debian-start[1254]: This installation of MariaDB is already upgraded to 10.3.34-MariaDB.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-11-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。