Could not install when using non-standard mysqli port

Could not install when using non-standard mysqli port

Weng Kong Lee發表於
Number of replies: 4

Hi all,

I'm quite new to Moodle, and was looking for an Intranet-based eLearning solution for my company when I chanced upon this wonderful software. I am now trying to install it on my development server to play with it, and figure out how ot use it effectively in my company.

Ran into some problems with the installation, because for security reasons, my company does not allow us to use standard ports for our servers/database, so I'm using a port number like 3400 for my MySQL database, instead of the normal 3306.

The below screenshot what the Moodle installer spitted out when I tried to create the database. Notice that I've tried to add the port number to the host using the <IP>:<port> convention but that does not work as well. I've tried to check the code for creation of mysql connections (in lib/dml/mysql_native_moodle_database.php), and it seems like the code seems to assume standard port, and has no arguments for alternative ports, though the mysqli APIs can take in such a parameter?

Here's the details of my installation:-
PHP: 5.2.12
MySQL: 5.1.34
Apache: 2.2.14
Moodle: 2.0 Weekly (1 Dec 2010)

Anyone has any ideas how to fix this? Or is there a patch already? Thanks!

評比平均分數: -
In reply to Weng Kong Lee

Re: Could not install when using non-standard mysqli port

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Clue:


$CFG->dboptions = array(
'dbpersist' => false, // should persistent database connections be
// used? set to 'false' for the most stable
// setting, 'true' can improve performance
// sometimes
'dbsocket' => false, // should connection via UNIX socket be
// used? if you set it to 'true' here,
// set dbhost to 'localhost'
'dbport' => '', // the TCP port number to use when connecting
// to the server. keep empty string for the
// default port
);


You'll need to edit config.php to add this information. For the record, all these odd settings can be found in config-dist.php.
In reply to Howard Miller

Re: Could not install when using non-standard mysqli port

Weng Kong Lee發表於

Hi Howard,

Thanks for the suggestion. Tried it, and it still fails. From the codes, I can see why:-

When I did a search for dbport in the Moodle 2.0 code-base, it only appears in 3 scripts

  • config.php/config-dist.php
  • lib/dml/oci_native_moodle_database.php
  • lib/dml/pgsql_native_moodle_database.php

It does not appear at all in lib/dml/mysql_native_moodle_database.php. In other words, the mysql script does not use this setting at all.

Hence I think this should be a bug to be resolved for MYSQL installation not using the dbport setting?

Thanks anyway for highlighting the setting in config-dist.php. Didn't notice that in any case 微笑 

In reply to Weng Kong Lee

Re: Could not install when using non-standard mysqli port

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I was going to ask you to raise this as a bug, but...

MDL-25532

Suggest you vote for it 微笑
評比平均分數:Useful (1)
In reply to Howard Miller

Re: Could not install when using non-standard mysqli port

Weng Kong Lee發表於

Hi Howard! Excellent pointer! Thanks! Will try this out. Should work like a charm this time round 大笑