1. 程式人生 > >show master status 時沒有資料顯示

show master status 時沒有資料顯示

環境:
系統:centos 7.0 (64位)
yum安裝的mysql資料庫。
今天做mysql主從時,檢視master日誌時沒有資料顯示,
mysql> show master status;
Empty set (0.00 sec)
mysql>

從網上搜了一下說是master資料庫沒有啟動show master status 時沒有資料顯示 最後終於弄出來了,
用yum安裝的mysql資料庫/etc/my.cnf檔案只是滿足基本要求,
如: [mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
server-id = 130
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
在/etc/my.cnf檔案中新增一行
log-bin=mysql-bin


然後重啟mysql資料庫即可;
mysql> show master status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000001 | 79 | | |
+——————+———-+————–+——————+
1 row in set (0.00 sec)

mysql>