Can mysql 5.6 encrypted CNF files be used with mysqli or PDO in php?

Mysql 5.6 allows you to create encrypted cnf files using mysql-config-editor .

I was hoping to use this to connect mysql in php. The current script uses the mysqli library.

To be clear, this has nothing to do with connecting over SSL, just being able to use the encrypted credentials files generated by mysql-config-editor.

+3


source to share


1 answer


I am not answering your question, but I suggest you. It is not very important to see the user and password from the encrypted .mylogin.cnf file. You can use this alternative way -

If you have access to login.cnf (like the unencrypted .mylogin.cnf format) through PHP, you can use parse_ini_file to open and read it.

It should allow you to place different sections directly into an associative array.



Something like that:

$settings = parse_ini_file('/path/to/login.cnf',true);

      

You can now connect to mysql using $ settings.

0


source







All Articles