How can I set a non-standard port for MySQL in OJS

For OJS in the [database] section in I can set the following options:

driver = mysql
host = ""
username = my_db_username
password = "*****"
name = my_db

By default the MySQL connection port is 3306. I need to use a custom port. How can I define my custom connection port in the [database] section in

In lib/pkp/lib/adodb/ I can see this: hostspec: Host specification (hostname[:port]). Does this mean that setting host in to something like host = "" will do the trick?

I haven’t tried it, but that makes sense to me. Is it giving you trouble?

I haven’t tried it yet, haven’t had time to set up a test environment and was looking for an obvious answer that I’ve missed somewhere. I’ts strange that no one has ever run into this issue before.

I’ve just tried it and it works. The database connection port can be appended to the database host after a colon in like this:
host = ""

Please update the documentation to add this feature. It looks like it’s currently nowhere to be found.

Hello, this solution works only partially. When non standard port is used submissions page returns connection error.

Setting port property in doesn’t help.

I am on version 3.1.1-2

@NateWr, is there a way the QueryBuilder (used by submissions listing) could work with this as well? Else, maybe we can parse the port?

Hi @jhamrak
Would it be possible for you to test if adding the port parameter, i.e. following line:
'port' => 'X',
(where X is your port number)
between these two lines pkp-lib/ at omp-3_1_1-2 · pkp/pkp-lib · GitHub
solves the problem?

Hello @bozana,

This is exactly the thing. Following two lines need to be added there, so the query is going to be correctly build in the Illuminate Database component for connections on custom ports / sockets.
'port' => Config::getVar('database', 'port'),
'unix_socket'=> Config::getVar('database', 'unix_socket'),
These properties could be then set in config file…

I’ll try to contrib on Github, it’s for my first time :). Don’t you know how I could create or find an issues for this bug?

BR Jarosalv

Hi @jhamrak

I see you have created a gitHub issue: Allow to connect on custom ports / socket · Issue #3860 · pkp/pkp-lib · GitHub ?
Let me know if you need any further help…


Hello @bozana,

here is PR for it