最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

实现MySQL的a-b

来源:动视网 责编:小采 时间:2020-11-09 11:04:58
文档

实现MySQL的a-b

实现MySQL的a-b:一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [ 一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [root@l
推荐度:
导读实现MySQL的a-b:一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [ 一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [root@l


一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [

一、需要环境

两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2

二、以下是个操作步骤;

虚理机一

[root@localhost ~]# yum install mysql mysql-server -y

[root@localhost ~]# vim /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

server_id = 1

log-bin=binlog

log-bin-index=binlog.index

# 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

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[root@localhost ~]# servicr mysqld start

bash: servicr: command not found

[root@localhost ~]# service mysqld start

[root@localhost ~]# mysql

mysql> quit

Bye

[root@localhost ~]# mysqldump -A -x >/tmp/full.sql

[root@localhost ~]# scp /tmp/full.sql root@192.168.1.2:/tmp/

root@192.168.1.2's password:

full.sql 100% 412KB 412.4KB/s 00:00

[root@localhost ~]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.0.77-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show master status;

+---------------+----------+--------------+------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |

+---------------+----------+--------------+------------------+

| binlog.000003 | 376 | | |

+---------------+----------+--------------+------------------+

1 row in set (0.00 sec)

mysql>

虚理机二

[root@localhost ~]# yum install mysql mysql-server -y

[root@localhost ~]# vim /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

server_id = 2

relay_log = /var/lib/mysql/mysql-relay-bin

relay_log_index=/var/lib/mysql/mysql-relay-bin.index

# 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

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[root@localhost ~]# service mysqld restar

[root@localhost ~]# cd /var/lib/mysql/

[root@localhost mysql]# ls

ibdata1 ib_logfile0 ib_logfile1 mysql mysql.sock test

[root@localhost mysql]# rm -fr *

[root@localhost mysql]# ls

[root@localhost mysql]# service mysqld restart

[root@localhost mysql]# mysql < /tmp/full.sql

[root@localhost mysql]# mysql> change master to master_host='192.168.1.1', master_port=3306, master_user='hfj', master_password='123', master_log_file='binlog.000003',master_log_pos=376;

[root@localhost mysql]# mysql

mysql> change master to master_host='192.168.1.1', master_port=3306, master_user='hfj', master_password='123', master_log_file='binlog.000003',master_log_pos=376;

Query OK, 0 rows affected (0.04 sec)

mysql> start slave;

Query OK, 0 rows affected (0.00 sec)

mysql> show slavw status;

mysql> show slave status \G;

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.1.1

Master_User: hfj

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: binlog.000003

Read_Master_Log_Pos: 376

Relay_Log_File: mysql-relay-bin.000002

Relay_Log_Pos: 232

Relay_Master_Log_File: binlog.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: 376

Relay_Log_Space: 232

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

1 row in set (0.00 sec)

ERROR:

No query specified

mysql>

文档

实现MySQL的a-b

实现MySQL的a-b:一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [ 一、需要环境 两台虚理机都安装 MYSQL服务 IP分别为192.168.1.1 192.168.1.2 二、以下是个操作步骤; 虚理机一 [root@l
推荐度:
标签: 数据库 mysql 的a
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top