Last active
December 7, 2016 13:19
-
-
Save alex-oliveira/935c1f0d3f8a64fd7db39ca9f36ce78d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo pico /etc/mysql/mysql.cnf | |
[mysqld] | |
federated | |
$ service mysql restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS `master`.t1; | |
CREATE TABLE `master`.t1 ( | |
id INT(20) NOT NULL AUTO_INCREMENT, | |
name VARCHAR(32) NOT NULL, | |
PRIMARY KEY(id) | |
); | |
DROP TABLE IF EXISTS `slave`.t1; | |
CREATE TABLE `slave`.t1 ( | |
id INT(20) NOT NULL AUTO_INCREMENT, | |
name VARCHAR(32) NOT NULL, | |
PRIMARY KEY(id) | |
) ENGINE=FEDERATED CONNECTION='mysql://homestead:[email protected]:3306/master/t1'; | |
INSERT INTO `master`.t1 (name) VALUE ('alex'); | |
INSERT INTO `master`.t1 (name) VALUE ('de'); | |
INSERT INTO `master`.t1 (name) VALUE ('oliveira'); | |
SELECT * FROM `master`.t1; | |
SELECT * FROM `slave`.t1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment