linuxx 发表于 2018-10-10 07:08:40

mysql 主从同步

  # mysql-u root -p
  Enter password:
  Welcome to the MySQL monitor.Commands end with ; or \g.

  Your MySQL connection>  Server version: 5.6.11-log MySQLCommunity Server (GPL)
  Copyright (c) 2000, 2013, Oracle and/orits affiliates. All rights reserved.
  Oracle is a registered trademark ofOracle Corporation and/or its
  affiliates. Other names may be trademarksof their respective
  owners.
  Type 'help;' or '\h' for help. Type '\c'to clear the current input statement.
  mysql> change master tomaster_host='192.168.2.163',master_user='slave',master_password='password123',master_log_file='mysql-bin.000001',master_log_pos=398;
  Query OK, 0 rows affected, 2 warnings(0.03 sec)
  mysql> flush privileges;
  Query OK, 0 rows affected (0.00 sec)
  mysql> start slave;                                 #启动同步
  Query OK, 0 rows affected (0.01 sec)
  mysql> show slave status;
  +----------------------------------+---------------+-------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+----------------------------+-----------+---------------------+-----------------------------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+

  | Slave_IO_State                   | Master_Host   | Master_User | Master_Port |Connect_Retry | Master_Log_File|Read_Master_Log_Pos |>  +----------------------------------+---------------+-------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+----------------------------+-----------+---------------------+-----------------------------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+

  | Waiting for master to send event |192.168.2.163 | slave       |      3306 |            60 | mysql-bin.000001 |               398 | SALT1-relay-bin.000002|         283 | mysql-bin.000001      | Yes            | Yes               |               |                     |                  |                        |                         |                           |          0 |            |            0 |               398 |             456 | None            |                |             0 | No               |                  |                  |               |                   |                |                     0 | No                            |             0 |               |            0 |                |                           |            163 | 0490786c-1519-11e7-a1c4-000c29623e16| /var/lib/mysql/master.info |          0 |                NULL | Slavehas read all>  +----------------------------------+---------------+-------------+-------------+---------------+------------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+----------------------------+-----------+---------------------+-----------------------------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+
  1 row in set (0.00 sec)
  mysql>

页: [1]
查看完整版本: mysql 主从同步