Difference between revisions of "MySQL notater"
From Teknologisk videncenter
m (New page: = simple Master slave replication setup = == Master == my.cnf: <source lang=text> [mysqld] log-bin server-id=1 #Next is only required if the #master is a slave as well log-slave-updates </...) |
m (→Slave) |
||
Line 35: | Line 35: | ||
mysql> SLAVE START; | mysql> SLAVE START; | ||
</source> | </source> | ||
+ | [[Category:database]] |
Revision as of 14:44, 13 December 2009
simple Master slave replication setup
Master
my.cnf:
[mysqld]
log-bin
server-id=1
#Next is only required if the
#master is a slave as well
log-slave-updates
Setup up in shell
shell> mysqldump –master-data \
> master.sql
mysql> GRANT REPLICATION SLAVE ON *.*
-> to rpl_user@host IDENTIFIED BY
-> ‘rpl_pass’;
Slave
my.cnf:
[mysqld]
server-id=2
Setup in shell
shell> mysql < master.sql
mysql> CHANGE MASTER TO
-> MASTER_HOST=‘master host’,
-> MASTER_USER=‘rpl_user’,
->
MASTER_PASSWORD=‘rpl_pass’,
-> MASTER_PORT=MySQL_port;
mysql> SLAVE START;