創作不易,關注、點贊,分享、了解網際網路前沿知識。
MySQL為什麼需要主從複制?
1.在一個業務複雜的系統中,有這樣一種場景,一條sql語句需要鎖表,導緻暫時無法使用讀服務,這将極大地影響業務的運作。采用主從複制,主庫負責寫,從庫負責讀。這樣,即使表被鎖定在主庫,也可以通過讀取從庫來保證業務的正常運作。
2.做資料熱備。
3.建築的擴充。業務量越來越大,I/O通路的頻率對于單機來說太高了。這時就需要多資料庫存儲來降低磁盤I/O通路的頻率,提高單機的I/O性能。
MySQL主從複制概念
MySQL主從複制意味着資料可以從一個MySQL資料庫伺服器主節點複制到一個或多個從節點。MySQL預設采用異步複制,讓從節點不用一直通路主伺服器來更新自己的資料,資料可以在遠端連接配接上更新。從節點可以複制主資料庫中的所有資料庫或特定資料庫或特定表。
MySQL 主從複制主要用途
1、讀寫分離
2、資料實時備份,當系統中某個節點出現故障的時候,友善切換
3、高可用HA
4、架構擴充
MySQL主從形式
原理
主從複制過程
以下雙主配置架構
MySQL安裝
MySQL安裝需要依次完成:
l 安裝前準備
l 安裝MYSQL
l 配置MySQL資料庫
l 資料庫主從配置
安裝媒體包包括:mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz,位于安裝媒體包的mysql檔案目錄下,本次安裝采用解壓式安裝。
MySQL安裝目錄為/usr/local/mysql。
MySQL資料檔案存放目錄為/data。
MySQL安裝以主機pmondbs01為例。
1.1 安裝前準備
在/tmp目錄建立plugin目錄,用于臨時存放MySQL安裝媒體。
使用指令
執行順序 | 指令 | 說明 |
1 | mkdir -p /tmp/plugin | 在/tmp/下建立plugin目錄 |
執行示意
[root@pmondbs01 ~] # mkdir /tmp/plugin |
然後以通過FTP方式上傳mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz。
1.2 安裝MySQL
MySQL安裝采用解壓式安裝,即解壓之後通過修改配置檔案的方式完成MySQL部署。
1. 資料庫檔案部署
使用指令
執行順序 | 指令 | 說明 |
1 | mkdir /usr/local/mysql | 建立MySQL安裝目錄 |
2 | cd /tmp/plugin/ | 進入MySQL安裝媒體路徑/tmp/plugin |
3 | tar -zxf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/mysql | 解壓mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz到/usr/local/mysql |
4 | mv /usr/local/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/* /usr/local/mysql/ | 移動/usr/local/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/下所有檔案到/usr/local/mysql/ |
5 | rm -rf /usr/local/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/ | 删除/usr/local/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/目錄 |
執行示意
[root@pmondbs01 ~] # mkdir /usr/local/mysql [root@pmondbs01 ~] # tar -zxf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/mysql [root@pmondbs01 ~] # mv /usr/local/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/* /usr/local/mysql/ [root@pmondbs01 ~] # rm -rf /usr/local/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/ |
2. 建立資料檔案目錄及資料庫專屬使用者賬号
資料檔案目錄為/data,資料庫專屬使用者為mysql和使用者組為mysql,需要将MySQL安裝目錄和資料檔案所在讀寫權限賦予使用者mysql。
使用指令
執行順序 | 指令 | 說明 |
1 | mkdir -p /data/ | 建立資料檔案目錄 |
2 | groupadd mysql | 建立mysql使用者組 |
3 | useradd -g mysql mysql | 建立mysql使用者 |
4 | chmod -R 755 /usr/local/mysql/ | 賦予MySQL安裝目錄 /usr/local/mysql/ 775權限 |
5 | chown -R mysql.mysql /usr/local/mysql/ | 改變MySQL安裝目錄屬主為mysql |
6 | chmod -R 755 /data/ | 賦予MySQL資料檔案目錄 /data/ 775權限 |
7 | chown -R mysql.mysql /data/ | 改變MySQL資料檔案目錄屬主為mysql |
執行示意
[root@pmondbs01 ~] # mkdir -p /data/ [root@pmondbs01 ~] # groupadd mysql [root@pmondbs01 ~] # useradd -g mysql mysql [root@pmondbs01 ~] # chmod -R 755 /usr/local/mysql/ [root@pmondbs01 ~] # chown -R mysql.mysql /usr/local/mysql/ [root@pmondbs01 ~] # chmod -R 755 /data/ [root@pmondbs01 ~] # chown -R mysql.mysql /data/ |
3. 主MySQL配置檔案
将安裝媒體中conf檔案夾下my.cnf通過FTP方式上傳至/etc/下,然後修改以下參數配置。
參數設定詳情為:
參數所屬節點 | 參數 | 值 |
mysqld | server-id | 1 |
port | 3306 | |
basedir | /usr/local/mysql | |
datadir | /data/ |
使用指令
執行順序 | 指令 | 說明 |
1 | vi /etc/my.cnf | 編輯MySQL配置檔案 |
2 | [mysqld] server-id =1 port =3306 basedir =/usr/local/mysql datadir = /data/ | [mysqld]參數節點,需要修改=号後面的值 |
執行示意
[root@pmondbs01 ~] # vi /etc/my.cnf [mysqld] server-id = 1 port = 3306 basedir =/usr/local/mysql datadir = /data/ |
4. 若啟用MySQL主從配置,則需要修改備庫MySQL配置檔案my.cnf,以pmondbs02為例,需要将參數server-id的值修改為10,其他配置和主庫配置保持一緻。
使用指令
執行順序 | 指令 | 說明 |
1 | vi /etc/my.cnf | 編輯MySQL配置檔案 |
2 | [mysqld] server-id =10 | [mysqld]參數節點,需要修改=号後面的值 |
執行示意
注意:以下操作在從MySQL資料庫上執行,比如從MySQL資料庫在pmondbs02主機上。
[root@pmondbs02 ~] # vi /etc/my.cnf [mysqld] server-id = 10 |
注意:在備MySQL資料庫上操作完畢。
5. 配置MySQL服務随作業系統啟動,
配置MySQL服務随作業系統啟動,需要從MySQL安裝目錄複制MySQL啟動腳本到/etc/init.d目錄下,檔案名為mysqld。然後在啟動腳本中添加MySQL的安裝目錄和資料檔案目錄,确認無誤後儲存,賦予mysqld檔案755權限,然後使用chkconfig設定MySQL随作業系統啟動。
MySQL啟動腳本位于/usr/local/mysql/support-files/目錄下,檔案名為mysql.server。
MySQL啟動腳本中需要修改:basedir=/usr/local/mysql和datadir=/data/。
使用指令
執行順序 | 指令 | 說明 |
1 | cp -af /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld | 複制MySQL啟動腳本mysql.server到/etc/init.d/目錄下,檔案名為mysqld |
2 | vi /etc/init.d/mysqld | 編輯/etc/init.d/mysqld檔案 |
3 | basedir=/usr/local/mysql datadir=/data/ | 輸入内容 |
4 | chmod 755 /etc/init.d/mysqld | 賦予MySQL啟動腳本755權限 |
5 | chkconfig --add mysqld | 添加MySQL啟動随系統啟動 |
6 | chkconfig --level 345 mysqld on | 修改MySQL啟動級别 |
執行示意
[root@pmondbs01 ~]# cp -af /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld [root@pmondbs01 ~]# vi /etc/init.d/mysqld # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. basedir=/usr/local/mysql datadir=/data/ [root@pmondbs01 ~]# chmod 755 /etc/init.d/mysqld [root@pmondbs01 ~]# chkconfig --add mysqld [root@pmondbs01 ~]# chkconfig --level 345 mysqld on |
6. 初始化MySQL資料庫
在MySQL安裝目錄進入bin目錄下執行帶上參數執行mysqld指令完成MySQL資料庫初始化。
mysqld指令初始化資料庫參數為--initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data。
使用指令
執行順序 | 指令 | 說明 |
1 | cd /usr/local/mysql/bin | 進入MySQL的bin目錄 |
2 | ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data | 帶參數執行mysqld |
執行示意
[root@pmondbs01 ~]# cd /usr/local/mysql/bin [root@pmondbs01 ~]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data |
1.3 配置資料庫
MySQL5.7以後root賬号的密碼采用啟動MySQL後生成随機密碼的方式,是以修改MySQL的root賬号密碼需要完成以下幾步操作。
1. 啟動MySQL服務
啟動MySQL服務指令為service mysqld start。
使用指令
執行順序 | 指令 | 說明 |
1 | service mysqld start | 啟動MySQL服務 |
2 | ln -s /tmp/mysql.sock /var/lib/mysql/[Joey1] mysql.sock | 建立/tmp/mysql.sock軟連結到/var/lib/mysql/mysql.sock |
執行示意
[root@pmondbs01 ~]# service mysqld start [root@pmondbs01 ~]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock |
2. 查詢root賬号臨時密碼
檢索在MySQL資料檔案目錄的mysql-error.log檔案可以查找到密碼,密碼檢索關鍵字為“password”,關鍵字“password”所在行“A temporary password is generated for root@localhost:”後面為臨時密碼,比如“swf88nhHgx(z”為臨時密碼。該臨時密碼作為第一次使用root賬号登入資料庫使用的密碼。
注:MySQLroot賬号的臨時密碼是随機生成的每次安裝都會産生不同的密碼。
mysql-error.log位于/data/下。
使用指令
執行順序 | 指令 | 說明 |
1 | cat /data/mysql-error.log|grep password | 讀取mysql-error.log并過濾關鍵password |
2 | 2020-01-08T15:48:42.569059+08:00 1 [Note] A temporary password is generated for root@localhost: swf88nhHgx(z | 輸出 |
執行示意
[root@pmondbs01 ~]# cat /data/mysql-error.log|grep password 2020-01-08T15:48:42.569059+08:00 1 [Note] A temporary password is generated for root@localhost: swf88nhHgx(z |
3. 修改root賬号密碼
登入MySQL資料庫,修改root賬号密碼為password,建立可以從任何主機通路資料庫的root賬号并設定密碼為password,用于管理資料庫;建立可以從任何主機通路資料庫的同步賬号repl并設定密碼為repl,用于MySQL資料庫主從同步,并給賬号賦予相應權限。
登入MySQL資料庫指令為mysql -uroot -p,回車之後輸入密碼,密碼為上一步操作查詢到的臨時密碼swf88nhHgx(z。
建立root賬号并設定密碼為password的SQL語句為:“create user root@'%' identified by 'password';”
授權root賬号具有所有權限的SQL語句為grant all privileges on *.* to root@'%';
修改root賬号密碼為password的SQL語句為alter user root@localhost identified by 'password';
使用指令
執行順序 | 指令 | 說明 |
1 | cd /usr/local/mysql/bin | 進入MySQL安裝目錄的bin目錄下 |
2 | ./mysql -uroot -p | 啟動MySQL用戶端 |
3 | swf88nhHgx(z | 輸入root賬号密碼,進入MySQL指令行用戶端。root賬号密碼在上一步驟中擷取。 |
4 | alter user root@localhost identified by 'password'; | 修改root賬号密碼為password |
5 | create user root@'%' identified by 'password'; | 建立可以從任何主機通路資料庫的root賬号并設定密碼為password |
6 | grant all privileges on *.* to root@'%'; | 授權可以從任何主機通路資料庫的root賬号所有權限 |
7 | flush privileges; | 重新整理資料庫權限 |
12 | flush privileges; | 重新整理資料庫權限 |
13 | create user repl@'%' identified by 'repl'; | 建立可以從任何主機通路資料庫的repl賬号并設定密碼為reple |
14 | grant replication slave on *.* to 'repl'@'%'; | 授權可以從任何主機通路資料庫的repl賬号replication slave權限 |
15 | flush privileges; | 重新整理資料庫權限 |
16 | quit; | 退出MySQL指令行用戶端 |
執行示意
[root@localhost ~]# cd /usr/local/mysql/bin [root@pmondbs01 bin]# ./mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.22-log Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]>alter user root@localhost identified by 'password'; Query OK, 0 rows affected (0.02 sec) MySQL [(none)]> create user root@'%' identified by 'password'; Query OK, 0 rows affected (0.05 sec) MySQL [(none)]> grant all privileges on *.* to root@'%'; Query OK, 0 rows affected (0.06 sec) MySQL [(none)]> flush privileges; Query OK, 0 rows affected (0.05 sec) MySQL [(none)]> create user 'zabbix'@localhost identified by 'zabbix'; Query OK, 0 rows affected (0.06 sec) MySQL [(none)]> create user 'zabbix'@'%' identified by 'zabbix'; Query OK, 0 rows affected (0.06 sec) MySQL [(none)]> grant all privileges on *.* to 'zabbix'@localhost; Query OK, 0 rows affected, 1 warning (0.05 sec) MySQL [(none)]> grant all privileges on *.* to 'zabbix'@'%'; Query OK, 0 rows affected (0.05 sec) MySQL [(none)]> flush privileges; Query OK, 0 rows affected (0.03 sec) MySQL [(none)]> create user repl@'%' identified by 'repl'; Query OK, 0 rows affected (0.04 sec) MySQL [(none)]> grant replication slave on *.* to 'repl'@'%'; Query OK, 0 rows affected (0.05 sec) MySQL [(none)]> flush privileges; Query OK, 0 rows affected (0.03 sec) MySQL [(none)]> quit; Bye [root@localhost bin]# |
1.4 資料庫主從配置
兩台MySQL資料庫做主從配置,假設情況如下:
主機名 | IP位址 | 角色 | 參數server-id | 同步使用者名 | 同步密碼 |
pmondbs01 | .81.49 | 主 | 1 | repl | repl |
pmondbs02 | .81.50 | 從 | 10 | repl | repl |
資料庫基本配置參考7.2、7.3。
資料庫主從配置參數server-id的值務必不能一樣。
參數server-id的值與前面章節保持一緻。
1.4.1 檢查配置server-id參數值
檢查.81.49并設定server-id參數值。
[root@pmondbs01 bin]# vi /etc/my.cnf [mysqld] server-id = 1 |
如果server-id參數值未設定為1,設定之後重新開機MySQL資料庫,設定server-id參數值參考7.2安裝MySQL。
檢查.81.50并設定server-id參數值。
[root@pmondbs02 bin]# vi /etc/my.cnf [mysqld] server-id = 10 |
如果server-id參數值未設定為10,設定之後重新開機MySQL資料庫,設定server-id參數值參考7.2安裝MySQL。
重新開機MySQL使用指令
執行順序 | 指令 | 說明 |
1 | service mysqld stop | 停止MySQL |
2 | service mysqld start | 啟動MySQL |
執行示意,以在伺服器pmondbs01上為例
[root@pmondbs01 ~] # service mysql stop [root@pmondbs01 ~] # service mysql start |
1.4.2 記錄主從狀态
1. 登入81.49 MySQL資料庫,執行show master status,檢查并記錄Master狀态。記錄File、Position,File為mysql-bin.000003,Position為194。
使用指令
執行順序 | 指令 | 說明 |
1 | cd /usr/local/mysql/bin | 進入MySQL安裝目錄的bin目錄下 |
2 | ./mysql -uroot -p | 啟動MySQL用戶端 |
3 | password | 輸入root賬号密碼,進入MySQL指令行用戶端。 |
4 | show master status; | 檢視Master狀态 |
執行示意
[root@pmondbs01 ~]# cd /usr/local/mysql/bin [root@pmondbs01 bin]# ./mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.22-log Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]>show master status; +------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+ | mysql-bin.000002 | 3842 | | | 15aa5540-31fc-11ea-9d2d-84139f30d4bd:1-14, 4a871e1c-31eb-11ea-81b2-84139f30d4f5:13-15 | +------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) MySQL [(none)]> |
2. 登入.81.50 MySQL資料庫,執行show master status,檢查并記錄Master狀态。記錄File、Position,File為mysql-bin.000003,Position為194。
使用指令
執行順序 | 指令 | 說明 |
1 | cd /usr/local/mysql/bin | 進入MySQL安裝目錄的bin目錄下 |
2 | ./mysql -uroot -p | 啟動MySQL用戶端 |
3 | password | 輸入root賬号密碼,進入MySQL指令行用戶端。 |
4 | show master status; | 檢視Master狀态 |
執行示意
[root@pmondbs02 ~]# cd /usr/local/mysql/bin [root@pmondbs02 bin]# ./mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.22-log Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]>show master status; +------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+ | mysql-bin.000003 | 3042 | | | 15aa5540-31fc-11ea-9d2d-84139f30d4bd:13-14, 4a871e1c-31eb-11ea-81b2-84139f30d4f5:1-15 | +------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) MySQL [(none)]> |
1.4.3 啟動主從
master_log_file和master_log_pos參數來自7.4.2記錄的File和Position。
登入.81.49MySQL資料庫之後執行“change master to master_host='.4.81.50',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=3042;”。
使用指令
執行順序 | 指令 | 說明 |
1 | cd /usr/local/mysql/bin | 進入MySQL安裝目錄的bin目錄下 |
2 | ./mysql -uroot -p | 啟動MySQL用戶端 |
3 | password | 輸入root賬号密碼,進入MySQL指令行用戶端。 |
4 | change master to master_host='81.50',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=194; | 檢視Master狀态 |
5 | start slave; | 啟動主從同步 |
執行示意
MySQL [(none)]> change master to master_host='.81.50',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=3042; MySQL [(none)]>start slave; |
登入.81.50MySQL資料庫之後執行“change master to master_host='.81.49',master_user='repl',master_password='repl',master_log_file='mysql-bin.000002',master_log_pos=3842;”。
使用指令
執行順序 | 指令 | 說明 |
1 | cd /usr/local/mysql/bin | 進入MySQL安裝目錄的bin目錄下 |
2 | ./mysql -uroot -p | 啟動MySQL用戶端 |
3 | password | 輸入root賬号密碼,進入MySQL指令行用戶端。 |
4 | change master to master_host='.81.49',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=194; | 檢視Master狀态 |
5 | start slave; | 啟動主從同步 |
執行示意
MySQL [(none)]> change master to master_host='.81.49',master_user='repl',master_password='repl',master_log_file='mysql-bin.000002',master_log_pos=3842; MySQL [(none)]>start slave; |
1.4.4 驗證主從狀态
登入.81.49MySQL資料庫執行指令show slave status \G;,檢視Slave_IO_Running、Slave_SQL_Running是否為Yes,為Yes表示主從正常執行。
執行指令:
show slave status \G;
MySQL [(none)]>show slave status \G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: .81.50 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000002 Read_Master_Log_Pos: 3842 Relay_Log_File: mysql-relay.000002 Relay_Log_Pos: 764 Relay_Master_Log_File: mysql-bin.000002 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 3842 Relay_Log_Space: 967 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 10 Master_UUID: 15aa5540-31fc-11ea-9d2d-84139f30d4bd Master_Info_File: mysql.slave_master_info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 15aa5540-31fc-11ea-9d2d-84139f30d4bd:13-14 Executed_Gtid_Set: 15aa5540-31fc-11ea-9d2d-84139f30d4bd:13-14, 4a871e1c-31eb-11ea-81b2-84139f30d4f5:1-15 Auto_Position: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec) ERROR: No query specified MySQL [(none)]> |
登入.81.50MySQL資料庫執行指令show slave status \G;,檢視Slave_IO_Running、Slave_SQL_Running是否為Yes,為Yes表示主從正常執行。
MySQL [(none)]>show slave status \G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: .81.49 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000003 Read_Master_Log_Pos: 3842 Relay_Log_File: mysql-relay.000002 Relay_Log_Pos: 1025 Relay_Master_Log_File: mysql-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 3842 Relay_Log_Space: 1228 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: 4a871e1c-31eb-11ea-81b2-84139f30d4f5 Master_Info_File: mysql.slave_master_info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 4a871e1c-31eb-11ea-81b2-84139f30d4f5:13-15 Executed_Gtid_Set: 15aa5540-31fc-11ea-9d2d-84139f30d4bd:1-14, 4a871e1c-31eb-11ea-81b2-84139f30d4f5:13-15 Auto_Position: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec) ERROR: No query specified MySQL [(none)]> |
ln: 無法建立符号連結"/var/lib/mysql/mysql.sock": 沒有那個檔案或目錄