cPanel & WHM Version 84 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 6 years ago
Completed

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:

/usr/local/cpanel/Cpanel/EximStats/ConnectDB.pm

/usr/local/cpanel/Cpanel/MysqlUtils/Connect.pm

/usr/local/cpanel/Cpanel/TailWatch/Eximstats.pm

/usr/local/cpanel/base/horde/config/conf.php

/usr/local/cpanel/base/3rdparty/roundcube/config/db.inc.php

/usr/local/cpanel/bin/leechprotect

/usr/local/cpanel/scripts/optimize_eximstats

/usr/bin/mysql_setpermission

/usr/local/cpanel/Cpanel/MysqlUtils/Connect.pm

/usr/local/cpanel/Cpanel/Mysql.pm

/usr/local/cpanel/sqloptimizer/analyze_sql

/usr/local/cpanel/bin/hulkdsetup

/usr/local/cpanel/bin/ldapsetup

/usr/local/cpanel/bin/mysqluserstore

/usr/local/cpanel/bin/build_mydns_conf

/usr/local/cpanel/scripts/update_db_cache

/usr/local/cpanel/scripts/optimize_eximstats

/usr/local/cpanel/scripts/restartsrv_mysql

/usr/local/cpanel/scripts/exportmydnsdb

/usr/local/cpanel/scripts/importmydnsdb


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/ConnectDB.pm 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
photo

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

Comments (4)

photo
2

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

photo
1

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.

photo
1

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.


Thanks!

Travis

photo
1

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.

Comments have been locked on this page!