【发布时间】:2017-06-08 08:41:49
【问题描述】:
我是 mariadb 的新手。今天,我试图将一个mysql数据库导入mariadb,在此过程中遇到如下警告时导入停止。
现在,我对自己说,我应该检查一个日志文件,这样我才能看到错误,但我似乎无法处理任何日志文件。我在Get the error log of Mariadb 的帮助下运行了以下查询:
如您所见,错误日志文件没有路径。
接下来我检查了/var/lib/mysql,下面是目录内容:
-rw-rw----. 1 mysql mysql 16384 Jun 5 16:03 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Jun 5 16:03 aria_log_control
-rw-rw----. 1 mysql mysql 79691776 Jun 8 08:02 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Jun 8 08:02 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Jun 5 16:03 ib_logfile1
-rw-rw----. 1 mysql mysql 6 Jun 5 16:12 IMSPRO.pid
drwx------. 2 mysql mysql 4096 Jun 8 08:02 ecommence
-rw-rw----. 1 mysql mysql 0 Jun 5 16:12 multi-master.info
drwx--x--x. 2 mysql mysql 4096 Jun 5 16:03 mysql
srwxrwxrwx. 1 mysql mysql 0 Jun 5 16:12 mysql.sock
drwx------. 2 mysql mysql 20 Jun 5 16:03 performance_schema
-rw-rw----. 1 mysql mysql 24576 Jun 5 16:12 tc.log
上述目录中没有文件记录错误。
以下是我/etc/my.cnf的内容
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
下面是/etc/my.cnf.d的内容
drwxr-xr-x. 2 root root 117 Jun 5 16:02 .
drwxr-xr-x. 91 root root 8192 Jun 7 01:14 ..
-rw-r--r--. 1 root root 295 May 29 16:48 client.cnf
-rw-r--r--. 1 root root 763 May 29 16:48 enable_encryption.preset
-rw-r--r--. 1 root root 232 May 29 16:48 mysql-clients.cnf
-rw-r--r--. 1 root root 1080 May 29 16:48 server.cnf
-rw-r--r--. 1 root root 285 May 29 16:48 tokudb.cnf
如何获取错误日志?
【问题讨论】:
-
您将 log_error 变量设置为文件名,瞧,文件被创建并写入(很可能在服务器重新启动后,谷歌太懒了)。
-
嗨@fancyPants,我应该把这个文件放在哪里?
-
对于 mysql,默认位置是
/var/log/mysql/。你可以把它放在你想要的任何地方。但通常是放在单独的分区上,这样即使日志占满了服务器也能继续运行。 -
嗨@fantyPants,我已将
server.cnf中的日志设置为log-error=/var/log/mysqld.log并重新启动了我的服务器并再次尝试导入,当它在警告处停止时,我没有看到此日志文件已创建。 -
可能是你必须自己创建它。只需
touch /var/log/mysqld.log并确保 mysql 用户有权访问它。