有没有办法从mysql控制台知道bin日志文件的路径,因为我们可以使用下面的命令知道它是打开还是关闭
Select * information_schema.GLOBAL_VARIABLES
where variable_name like '%log_bin%'. 发布于 2013-12-04 18:00:38
使用此选项显示on/off
SHOW VARIABLES LIKE 'log_bin'还包括:
SHOW GLOBAL VARIABLES LIKE '%bin%'或
SHOW SESSION VARIABLES LIKE ...更多信息:(请注意,其中一些值和结果从5.5更改为5.6!)
http://dev.mysql.com/doc/refman/5.5/en/show-master-status.html
mysql > SHOW MASTER STATUS;
+---------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+---------------+----------+--------------+------------------+
| mysql-bin.003 | 73 | test | manual,mysql |
+---------------+----------+--------------+------------------+
mysql> SHOW BINARY LOGS;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.000015 | 724935 |
| binlog.000016 | 733481 |
+---------------+-----------+发布于 2016-05-24 01:53:53
来自关于log-bin的docs“
Setting this option causes the log_bin system variable to be set
to ON (or 1), and not to the base name. This is a known issue;
see Bug #19614 for more information.在我稍微修改过的Bug 19614中,有一个使用mysqld的变通方法。如果你在编写脚本,你可以从mysql客户端使用(我发现这样做有点单调乏味,请看下面的变通方法):
mysql >\! dirname $(mysqld --help --verbose 2> /dev/null | egrep "^log-bin " | grep -o "\/.*")
看起来有一个补丁是由Mark Callaghan提交的,但从未提交过。WP5465中有一个函数(这是这个补丁正在进行的工作),但是它对我来说不能正常工作,因为日志的位置在不同的设置中可能会有所不同。
https://stackoverflow.com/questions/20372106
复制相似问题