Omke-s erreur (ssl): An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user

Hello,
I am looking to disable SSL to connect to my hosting with Omeka-s 3.1.2 and I would like to know how I can integrate “MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT” in the code using Mysqli, the file is in “omeka-s\vendor\laminas-db\src\Adapter\Driver\Mysqli” to install the cms.
Php : 7.4.14
Mysql : 8.0.28
Omeka-s : 3.1.2
error: “An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user”.
Ps: I can connect via a simple php script like this:

$conn = mysqli_init();
	$conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false);
	mysqli_ssl_set($conn, , , ,);

	$conn->real_connect('$hostname', $username, password,$dbname,$port,'MYSQLI_CLIENT_SSL');

Thanks for your help.
Linus_11

Translated with DeepL Translate: The world's most accurate translator (free version)

Can you just connect without SSL at all, instead of using it but disabling the certificate verification?

If you have to have it, then you can pass options to PDO using driverOptions in the database.ini file. The only wrinkle is that you can’t use the PDO:: constants you need in that file so you’d have to look up what they are actually. For example for me, setting PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT to 0 and PDO::MYSQL_ATTR_SSL_CA to the empty string looks like this at the end of config/database.ini:

driverOptions[1014] = 0
driverOptions[1009] = ''

Hello,

Sorry for the delay in my reply, I thought I had not been notified, your email went into spam.

I finally stayed on Omeka classic which works for me. Unfortunately Omeka-s didn’t work, though I would have liked to use it (more flexibility, features)

I don’t know in which folder in Omeka you can find the Init database, in the root of my FTP I only have a “config” folder, a db.ini file (If you know where to find the file/url to modify the PDO parameters you can tell me, thanks! - mybe at this url ? “omeka-s-3.1.2\omeka-s\vendor\laminas\laminas-db\src\Adapter\Driver\Mysqli” ? )

“db.ini” contains only this few lines :


user = ""

password = "".

dbname = ""

host = ""

;port =

;unix_socket =

;log_path =

For Omga classic I modify / added this lines at : “application/libraries/Zend/Db/Adapter/Mysqli.php”

add line 322

mysqli_ssl_set($this->_connection, NULL, NULL, NULL, 'null', NULL);

and replace.

  $_isConnected = @mysqli_real_connect(
            $this->_connection,
            $this->_config['host'],
            $this->_config['username'],
            $this->_config['password'],
            $this->_config['dbname'],
            $port,
            $socket
        );

with

$_isConnected = @mysqli_real_connect(
            $this->_connection,
            $this->_config['host'],
            $this->_config['username'],
            $this->_config['password'],
            $this->_config['dbname'],
            $port,
            $socket,
            MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT
        );

Thank lot for help !

You can’t use the mysqli connection options/functions in Omeka S, because it uses PDO instead.

Did you try the option I suggested above, of adding those “driverOptions” settings to the config/database.ini file? Even though they’re not listed by default, you can just add them at the end. You have to use those sort of opaque numbers, but you could use the PHP command line or write a simple script to look up what their values are for your system:

<?php
echo PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT . "\n" . PDO::MYSQL_ATTR_SSL_CA;