RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
mysql的日志怎么用,mysql中,关于各类日志

怎么开启mysql日志功能

1)怎么查看mysql是否启用了日志

成都创新互联公司-专业网站定制、快速模板网站建设、高性价比綦江网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式綦江网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖綦江地区。费用合理售后完善,10多年实体公司更值得信赖。

mysqlshow variables like 'log_bin';

2)怎样知道当前的日志

mysql show master status;

3)如何查看当前的二进制日志,可以使用mysqlbinlog的的工具,命令如下:

shellmysqlbinlog mail-bin.000001(要写绝对问题路径 d://)

或者shellmysqlbinlog mail-bin.000001 | tail

4)mysql有以下几种日志:

错误日志:    

-log-err

查询日志:    

-log

慢查询日志:   

-log-slow-queries

更新日志:     

-log-update

二进制日志: 

-log-bin

在mysql的安装目录下,打开my.ini,在后面加上上面的参数,保存后重启mysql服务就行了。

例如:

#Enter a name for the error

log file.   Otherwise a default

name will be used.

log-error=err.log

#Enter a name for the query

log file. Otherwise a default name will be used.

#log=

#Enter a name for the slow

query log file. Otherwise a default name will be used.

#log-slow-queries=

#Enter a name for the update

log file. Otherwise a default name will be used.

#log-update=

#Enter a name for the binary

log. Otherwise a default name will be used.

#log-bin=

上面只开启了错误日志,要开其他的日志就把前面的“#”去掉。

long_query_time =2--

这里设置慢日志的最大实现是指执行超过多久的sql会被log下来,这里是2秒

log-slow-queries=slowqueris.log --将查询返回较慢的语句进行记录,这里设置慢日志的名称

log-queries-not-using-indexes

= nouseindex.log --就是字面意思,log下来没有使用索引的query

5)下面是配置日志的几种方式,不一定全都要配置,请根据自身需求选择性配置

log=mylog.log

--对所有执行语句进行记录

log-error=log-error.log

log=log-query.log

log-queries-not-using-indexes

log-warnings=2

log-slow-queries=log-slow-query.log

log-update=log-update.log

long_query_time=2

mysql数据库日志怎么看

MySQL的日志文件模块启动后才会有日志记录。

开启日志服务:

在MY.INI里,MYSQLD项下添加log-bin=mysql。

如果只对某个库进行日志文件记录,那么再添加binlog-do-db=test,这样就只记录test数据库的日志,而放弃其他的。

添加完后,重新启动MYSQL的服务,日志文件开始工作了.

查看是否启用了日志命令:mysqlshow variables like 'log_bin';

查看当前的日志命令:mysql show master status;

看二进制日志文件用mysqlbinlog命令:shellmysqlbinlog mail-bin.000001

mysql如何使用事物日志ib

,查看Mysqld(/var/log/mysqld.log)日志,发现以下错误:

InnoDB: Error: log file /usr/local/mysql/data/ib_logfile0 is of different size 0

5242880 bytes

InnoDB: than specified in the .cnf file 0 104857600 bytes!

030826 1:42:15 Can't init databases

030826 1:42:15 Aborting

2,解决办法

"

If you want to change the number or the size of your InnoDB log files, you

have to shut down MySQL and make sure that it shuts down without errors.

Then copy the old log files into a safe place just in case something went

wrong in the shutdown and you will need them to recover the database. Delete

then the old log files from the log file directory, edit my.cnf, and start

MySQL again. InnoDB will tell you at the startup that it is creating new log

files.

"

在你修改my.cnf的innodb_log_file_size参数前,请先停止mysql服务程序的运行(mysql的停止没有出现任何错误),并把/var/lib/mysql目录下的ib_logfile0、ib_logfile1、ib_logfile2等之类的文件移除到一个安全的地方(旧日志文件的保留是为了防止意外的出现),以便Mysql重启后可以将新的ib_logfile0之类日志文件生成到/var/lib/mysql目录下。如果没有什么意外,旧的日志文件可以删除。

mysql日志文件怎么用?

my.cnf 这个mysql日志分:错误日志,二进制日志,慢查询日志,转储日志,每一种都有不同的作用,查看全局变量,显示为on即为开启,显示为off即为关闭,具体怎么用,不是一言两语能说清楚的。建议去51cto里查看相关技术博客

MySQL软件的日志操作介绍

方法/步骤

1、首先,登陆mysql后,执行sql语句:

show

variables

like

'log_bin';

查看是否日志开启,详细结果如图:

2、#错误日志

log-error

开启方式:

在my.ini的[mysqld]选项下:

添加代码:

log-error=E:\log-error.txt

记录内容:

主要是记录启动、运行或停止mysqld时出现的致命性问题,都是系统级的错误记录如图:

3、#查询日志

log

开启方式:

在my.ini的[mysqld]选项下:

添加代码:

log=E:/mysql_log.txt

记录内容:

主要是记录数据库建立的客户端连接和执行的语句如图:

4、#二进制日志

log-bin

开启方式:

在my.ini的[mysqld]选项下:

添加代码:

log-bin=E:/mysql_log_bin

记录内容:

主要是记录所有的更改数据的语句,可使用mysqlbinlog命令恢复数据。如图:

#慢日志

log-slow-queries

开启方式:

在my.ini的[mysqld]选项下:

添加代码:

long_query_time

=1

(设定慢查询的标准,单位是s/秒)

log-slow-queries=

E:/mysql_log_slow.txt

记录内容:

主要是记录所有执行时间超过long_query_time的查询或没有使用索引的查询如图:

以上就是专题栏小编带来的mysql中文版教程,更多教程请看“”


新闻名称:mysql的日志怎么用,mysql中,关于各类日志
网页链接:http://scyingshan.cn/article/phjjde.html