Pointing Omeka to a specific mysql socket


#1

I have multiple mysql instances running on my Red Hat server. The instance I created for Omeka is mysqld2 with mysql2.sock at port 3308. I can’t figure out how to point Omeka to this specific instance of mysql. Has anyone done this? I’m getting the error - Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ But of course that is because it needs to connect to mysql2.sock.

Thanks


#2

What have you tried? There are configuration options for both port and unix_socket in the database configuration file for Omeka S.

Generally, the unix socket will only be used if you give the host literally as “localhost,” to use the port number instead you’d want to specify the host as “127.0.0.1” (the IP address for localhost). The unix_socket parameter should work fine with localhost, though.


#3

Below is my database.ini. For the host I have tried localhost, 127.0.0.1 and the IP address and name of the server.

user = mysql
password = xxxxxxxxxxxxx
dbname = mysql2
host = localhost
;port = 3308
;unix_socket = /var/lib/mysql/mysql2.sock
;log_path = /var/www/html/omeka-s/logs

The error I am getting when I try to login is:
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

On the login screen the values I am using are:
System MySQL
Server localhost
Username mysql
Password •••••••••••••••
Database mysql2

Thanks,
Jack


#4

Is the socket actually at /var/lib/mysql/mysql2.sock ?

You’ve left that line commented out so it won’t have any effect (that’s what the leading semicolon means, so remove that if you’re intending to set the unix_socket line, or port or log_path for that matter).


#5

Thanks, I did not realize semicolons were used to comment out lines. I removed them but nothiong changed.

Yes, mysql2.sock is under /var/lib/mysql and it is declared in my.cnf. But according to the error message, the process is trying to use mysql.sock, not mysql2.sock. It does not seem to be reading the database.ini file under config.


#6

If the file is at config/database.ini that’s where it should be and where Omeka S will look for it.

I don’t quite understand what the reference to “login screen” is, though.


#7

The adminer login screen