Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Start a MySQL master/slave pair.
rm -R $HOME/Desktop/server-{1,2}
mkdir -p $HOME/Desktop/server-{1,2}
mysql_install_db --datadir=$HOME/Desktop/server-1 && mysqld --server-id 1 -h ~/Desktop/server-1 --socket ~/Desktop/server-1/mysql.sock -P 10001 --log-bin &
mysql_install_db --datadir=$HOME/Desktop/server-2 && mysqld --server-id 2 -h ~/Desktop/server-2 --socket ~/Desktop/server-2/mysql.sock -P 10002 --master-port=10001 --master-host= --master-user=root &
alias sql-master="mysql -h127.0.0.1 -P10001 -uroot"
alias sql-slave="mysql -h127.0.0.1 -P10002 -uroot"
alias sql-master-admin="mysqladmin -h127.0.0.1 -P10001 -uroot"
alias sql-slave-admin="mysqladmin -h127.0.0.1 -P10002 -uroot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment