Developing software in the Real World

Password less command line scripts with MySQL 5.6

I have a number of command line scripts that copy MySQL databases down from staging servers and store them locally. These scripts set the password on the command line using the -p option.

With MySQL 5.6, a new warning is displayed every time my scripts run:

This is annoying!

The way to solve this is to use the new command line tool mysql_config_editor to set up a "login path" which the mysql command line client can then use.

You will then be asked to enter the password for the user that you've set, 'restore' in this case.

Now, you can log in to mysql on the command line using:

and note that you didn't need to enter a password!

In my case, I then changed my scripts so that the restore line looks like this:

One thought on “Password less command line scripts with MySQL 5.6

Comments are closed.