configure connection to mySQL with ssl
-
Hello!
I want to contribute with suggestions to enable SSL connection to MySQL.Every connection between my web server and my mySQL server travels over secure connection with SSL.
Currently the script “installer.php” There is no option to configure SSL connection to MySQL.I changed directly in the source code on line 248.
(It may not be the best option)/* $dbh = @mysqli_connect( $host, $username, $password, $dbname, $port ); */ $dbh = mysqli_init(); mysqli_options ($dbh, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true); $dbh->ssl_set('/path/to/client-key.pem', '/path/to/client-cert.pem', '/path/to/ca.pem', NULL, NULL); $link = mysqli_real_connect ($dbh, $host, $username, $password, $dbname, $port, NULL, MYSQLI_CLIENT_SSL);
Another option, the best is to use PDO:
$pdo = new PDO('mysql:host=ip;dbname=db', 'user', 'pass', array( PDO::MYSQL_ATTR_SSL_KEY =>'/etc/mysql/ssl/client-key.pem', PDO::MYSQL_ATTR_SSL_CERT=>'/etc/mysql/ssl/client-cert.pem', PDO::MYSQL_ATTR_SSL_CA =>'/etc/mysql/ssl/ca-cert.pem' ) );
See suggestion this link: https://stackoverflow.com/questions/9139470/how-to-use-the-mysql-client-ssl-setting-with-mysql-connect-in-php
Note: I used the first suggestion and it worked for me.
I hope these suggestions come to the developers like to be added in the installation interface options.
- The topic ‘configure connection to mySQL with ssl’ is closed to new replies.