标签:osi tar.gz character hash .so 建立 span 进制 密码
今天有时间写写,不然心坎里总有点不爽。单机多实例一直都是屌丝的处事风格。。。
RHEL6.5
172.24.0.130 3306
172.24.0.130 3307
下载地址:
https://dev.mysql.com/downloads/mysql/
http://pan.baidu.com/s/1qYI0ybq
http://pan.baidu.com/s/1pLHM2TH 密码: pg5t
#截图操作
#根据需求选择对应的版本
tar zxf xxx.tar.gz -C /tmp
mkdir -p {data_3306,data3307} #存放数据
mkdir conf #放my.cnf
#3306my.cnf
[client] default-character-set=utf8 #客户端连接编码 [mysql] auto-rehash #客户端tab补全 default-character-set=utf8 #编码 [mysqld]
user=mysql #运行账户 port=3306 #定义端口 log-bin=mysql-bin #开启二进制日志 server-id=001 #定义服务ID max_allowed_packet=50M ###最大 wait_timeout=3600 ###等待超时默认s interactive_timeout=3600 ###活动超时 innodb_buffer_pool_size = 128M join_buffer_size = 128M sort_buffer_size = 2M read_rnd_buffer_size = 2M basedir=/tmp/mysql_mulit #MYSQL根目录 datadir=/tmp/mysql_mulit/data_3306 #MYSQL数据存放目录 socket=/tmp/3306_mysql.sock #套接字 init_connect=‘SET collation_connection = utf8_unicode_ci‘ init_connect=‘SET NAMES utf8‘ character-set-server=utf8 #定义数据库默认字符 server\collation collation-server=utf8_unicode_ci skip-character-set-client-handshake symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
lower_case_table_names = 0 #对表的大小写不敏感
[mysqld_safe] log-error=/tmp/3306_err.log #错误日志 pid-file=/tmp/mysql_mulit/data_3306/mysqld.pid #pid,多协议通信 tcp/sock
3307my.cnf
[client] default-character-set=utf8 #客户端连接编码 [mysql] auto-rehash #客户端tab补全 default-character-set=utf8 #编码 [mysqld]
user=mysql port=3307 #定义端口 log-bin=mysql-bin #开启二进制日志 server-id=011 #定义服务ID max_allowed_packet=50M ###最大 wait_timeout=3600 ###等待超时默认s interactive_timeout=3600 ###活动超时 innodb_buffer_pool_size = 128M join_buffer_size = 128M sort_buffer_size = 2M read_rnd_buffer_size = 2M basedir=/tmp/mysql_mulit #MYSQL根目录 datadir=/tmp/mysql_mulit/data_3307 #MYSQL数据存放目录 socket=/tmp/3307_mysql.sock #套接字 init_connect=‘SET collation_connection = utf8_unicode_ci‘ init_connect=‘SET NAMES utf8‘ character-set-server=utf8 #定义数据库默认字符 server\collation collation-server=utf8_unicode_ci skip-character-set-client-handshake symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES lower_case_table_names = 0 #对表的大小写不敏感 [mysqld_safe] log-error=/tmp/3307_err.log #错误日志 pid-file=/tmp/mysql_mulit/data_3307/mysqld.pid #pid,多协议通信 tcp/sock
./scripts/mysql_install_db --defaults-file=conf/3306my.cnf
./scripts/mysql_install_db --defaults-file=conf/3306my.cnf
./bin/mysqld_safe --defaults-file=conf/3306my.cnf &
./bin/mysqld_safe --defaults-file=conf/3307my.cnf &
./bin/mysqladmin -P 3306 -u root password ‘123123‘
./bin/mysqladmin -P 3307 -u root password ‘123123‘
建立从复制账号
grant replication slave on *.* to ‘mysync‘@‘%‘ identified by ‘123456‘; #所有IP
grant replication slave on *.* to ‘mysync‘@‘localhost‘ identified by ‘123456‘; #127.0.0.1
grant replication slave on *.* to ‘mysync‘@‘zabibx‘ identified by ‘123456‘; #172.24.0.130, zabbix是主机名
查看Master信息
mysql> show master status; #目的跟slave对上口径
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000003 | 541 | | | |
+------------------+----------+--------------+------------------+-------------------+
进入mysql与master主机建立连接
change master to master_host=‘172.24.0.130‘,master_port=3306,master_user=‘mysync‘,master_password=‘123456‘, master_log_file=‘mysql-bin.000003‘,master_log_pos=541;
show slave status\G;
start slave; #启动从主机 stop slave;停止从主机
#截图中两个yes说明从机已经连接到主机
标签:osi tar.gz character hash .so 建立 span 进制 密码
原文地址:http://www.cnblogs.com/xiaochina/p/6886115.html