DEV Community

yuki777
yuki777

Posted on • Edited on

Connect multiple MySQL database server on local Mac

Connect MySQL with custom port and socket

# MySQL 8.0.23 with port 13306
cd ~/tmp/path-to-your-dir
cd mysql/versions/8.0.23
dir=`pwd`
$dir/basedir/bin/mysql \
 --user=root \
 --host=localhost \
 --port=13306 \
 --socket=/tmp/dbdb_mysql_13306.sock

# MySQL 8.0.23 with port 23306
cd ~/tmp/path-to-your-dir
cd mysql/versions/8.0.23
dir=`pwd`
$dir/basedir/bin/mysql \
 --user=root \
 --host=localhost \
 --port=23306 \
 --socket=/tmp/dbdb_mysql_23306.sock

# MySQL 5.7.31 with port 33306
cd ~/tmp/path-to-your-dir
cd mysql/versions/5.7.31
dir=`pwd`
$dir/basedir/bin/mysql \
 --user=root \
 --host=localhost \
 --port=33306 \
 --socket=/tmp/dbdb_mysql_33306.sock

# MySQL 5.7.31 with port 43306
cd ~/tmp/path-to-your-dir
cd mysql/versions/5.7.31
dir=`pwd`
$dir/basedir/bin/mysql \
 --user=root \
 --host=localhost \
 --port=43306 \
 --socket=/tmp/dbdb_mysql_43306.sock
Enter fullscreen mode Exit fullscreen mode

Top comments (0)