Amit
Amit

Reputation: 21

read file from inside mysql my.cnf

I know that mysql can read username and password from my.cnf like shown below,

[mysql]
user=root
password=myrootpassword

However. if I have to read password from another file from inside this my.cnf, how would I do that? For example as shown below,

[mysql]
user=root
password=/path/to/a/file/containing/password

Thanks in advance!

Upvotes: 1

Views: 67

Answers (1)

Ondřej Šotek
Ondřej Šotek

Reputation: 1812

You can use directive !include for specifying another configuration file in MySQL .cnf files - something like:

!include /path/to/a/file/containing/password.cnf

and then provide password within that specified file.

See more here - http://dev.mysql.com/doc/refman/5.7/en/option-files.html

Upvotes: 2

Related Questions