search

Mysql 5.7 Directive Password


The problem is mysql can not store directive password in shell. If doing repetition for import many sql in file, we must entered password as how many file sql.

Warning: Using a password on the command line interface can be insecure.

Create File ~/.my.conf

[client]
host=localhost
user=dump
password='dump'

command

mysqldump --defaults-file=~/.my.conf testing > testing.sql

or can use

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

Then you can use in your shell script:

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

Instead of:

mysql -u username -p pass -e "statement"
close
Visit Us On TwitterVisit Us On GooglePlusVisit Us On Linkedin

Hi, guest!

settings

menu