Mysql Warning Using a Password on The Command Line Interface Can be Insecure

If you are using command line interface to access your Mysql server and getting “Mysql Warning Using a Password on The Command Line Interface Can be Insecure”. You can resolve this warning by specifying it in the file using the utility mysql_config_editor.

In this article I will show you how to resolve this issue.

Follow the below command to set the credentials using the following command:

mysql_config_editor set --login-path=local --host=localhost --user=username --password

You can run the below command as:

mysql --login-path=local -e "statement"

Instead of:

mysql -u username -p pass -e "statement"

Alternately for older version is to use –defaults-extra-file option.

Create my.cnf file with credentials:

# vim .my.cnf
host = hostname
user = username
password = password

Save and close file. Now run the mysql command with specifying the my.cnf file. For example:

mysql --defaults-extra-file=/path_to/my.cnf
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment