MySQL 日志在哪里?Fedora

MySQL 日志在哪里?Fedora

你好,我刚刚从源代码在 Fedora 上安装了 MySQL,使用了 cmake、make、make install 等。它可以正常工作,但我在哪里可以找到服务器的日志?我查看了 /var/log,但遗憾的是没有找到 mysql 的任何信息。

/etc/my.cnf

# For advice on how to change settings please see
# 
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES    

答案1

如果你正在运行 mysqld,你可以检查它的打开描述符来查看它记录的位置,例如使用 proc:

[root@localhost ~]# ls -l `pgrep mysqld | sed 's@.*@/proc/&/fd/@'` | grep log
l-wx------. 1 root root 64 Jul 23 10:47 1 -> /var/log/mysqld.log
l-wx------. 1 root root 64 Jul 23 10:47 2 -> /var/log/mysqld.log
lrwx------. 1 root root 64 Jul 23 10:47 8 -> /var/lib/mysql/ib_logfile0
lrwx------. 1 root root 64 Jul 23 10:47 9 -> /var/lib/mysql/ib_logfile1
[root@localhost ~]# 

在这种情况下是 /var/log/mysqld.log

答案2

有不同类型的日志,由以下全局 MySQL 变量决定:

如果您想读取错误日志文件,请尝试以下命令:

sudo tail -f $(mysql -Nse "SELECT @@GLOBAL.log_error")

完成后点击Control- 。C

相关内容