This is just a note to myself. I don’t do this often enough to remember the command, but whenever I’m searching for this, it takes half a minute to find it in MySQL manual, so hopefully this gets indexed better (in my memory as well as in Google).
Here’s the simple command to create a login path:
mysql_config_editor set --login-path=mysql1 --host=localhost \ --port=3306 --socket=/path/to/socket --user=root --password
Obviously you can remove just about anything and only leave the essentials.
Once that’s done, accessing different MySQL instances is as
mysql --login-path=mysql1, which is
especially useful if you’re accessing different servers from one
machine, or if you’re running several MySQL instances on the same
More information on login paths …[Read more]