Difference between revisions of "MySQL notater"

From Teknologisk videncenter
Jump to: navigation, search
m (simple Master slave replication setup)
m
 
Line 36: Line 36:
 
mysql> SLAVE START;
 
mysql> SLAVE START;
 
</source>
 
</source>
 +
= Links =
 +
*[http://hashmysql.org/index.php?title=Main_Page MySQL WIKI]
 
[[Category:database]]
 
[[Category:database]]

Latest revision as of 09:57, 17 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;

Links