cPanel & WHM Version 108 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

MySQL + Non-Standard Port

DragonByte Tech shared this idea 10 years ago

Currently, very few parts of WHM/cPanel supports accessing a MySQL server using a non-standard port (remote or local).

A quick grep shows that some or all of the following files need to be updated to support port numbers other than 3306:





















Most notably, Eximstats (and subsequently, the Mail Delivery Reports feature) will not work at all unless I manually edit some of the above files.

Mail delivery reports are very important to the operation of our website, as if a customer reports not receiving critical purchase confirmation information (without which, they cannot access their purchased products) this is something we need to investigate A.S.A.P. to ensure there's no issue on our end preventing mail delivery.

I'm not a Perl programmer, but it seems easy enough to implement an additional sub, something like

  1. sub getmydbhost {
  2. my $port = _getmydbparm( 'port', @_ );
  3. if ($port) {
  4. return $port;
  5. }
  6. else {
  7. return 3306;
  8. }
  9. }

To use /usr/local/cpanel/Cpanel/EximStats/ as an example:

  1. my $dbhost = Cpanel::MysqlUtils::MyCnf::Basic::getmydbhost('root') || 'localhost';
  2. my $dbport = Cpanel::MysqlUtils::MyCnf::Basic::getmydbport('root') || '3306';
  3. my $cpconf_ref = Cpanel::Config::LoadCpConf::loadcpconf();
  4. $dbh = eval { DBI->connect( "DBI:mysql:$database:$dbhost:$dbport" . ( $cpconf_ref->{'mysql_version'} >= 4.1 ? ';mysql_multi_statements=1;mysql_server_prepare=1' : '' ), $dbuser, $dbpassword ); }
  5. unless ($dbh) {

I hope this can be implemented, I would appreciate it greatly :)

Best Answer

There will be the ability to connect to non standard remote MySQL ports in 11.52.

Replies (4)


There will be the ability to connect to non standard remote MySQL ports in 11.52.


This makes me very happy, thank you :)

Along with the recent change to allow update staging to be moved to another directory, I'm very impressed with the recent behind-the-scenes changes that may seem small or irrelevant to most people but are incredibly useful in certain fringe cases.


DragonByte Tech,

I'm glad to help. It's funny that you mention Staging Dirs. That's another project worked on by my team. Team Spiderpig. Please let me know if you want to try it out.




We do take advantage of the update staging directory on one of our servers :)

For the longest time we were stuck on 11.45 due to the space change requirement (60 GB SSD for the OS partition, so /usr only has 9.7 GB in total). By blanking pretty much every log file in existence and uninstalling a few core apps we didn't use (removed all webmail apps other than Squirrelmail and removed old version archives), we managed to get onto 11.48 I think it was, which allowed us to then move to 11.50.

Replies have been locked on this page!