Skip to content

Instantly share code, notes, and snippets.

@vaibhaw
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save vaibhaw/42bd044f3711cd9daeb4 to your computer and use it in GitHub Desktop.

Select an option

Save vaibhaw/42bd044f3711cd9daeb4 to your computer and use it in GitHub Desktop.
-- To login into mysql through command line similar to connecting ssh hosts
-- write following options in your ~/.my.cnf file
-- Ref # http://dba.stackexchange.com/q/3889
[clientremote]
host=db_host_ip
user=db_username
password=db_password
database=db_schema
[clientlocal]
host=127.0.0.1
user=db_username
password=db_password
database=db_schema
-- Use following command on terminal to connect to specific server
mysql --defaults-group-suffix="remote"
-- setup alias in ~/.profile or in ~/.bashrc to avoid typing full text
echo 'alias mysql_remote="mysql --defaults-group-suffix=remote"' >> ~/.profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment