O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

Create the .mylogin.cnf file using mysql_config_editor:

shell> mysql_config_editor set --login-path=dbadmin_local --host=localhost --user=dbadmin --passwordEnter password:

You can add multiple hostnames and passwords by changing the login path. If the password is changed, you can run this utility again, which updates the password in the file:

shell> mysql_config_editor set --login-path=dbadmin_remote --host=35.186.157.16 --user=dbadmin --passwordEnter password: 

If you want to log in to 35.186.157.16 using the dbadmin user, you can simply execute mysql --login-path=dbadmin_remote:

shell> mysql --login-path=dbadmin_remote Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 215074~mysql> SELECT ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required