Enrolment Remote Database Connection failing

I cannot get the Enrolment plugin to work to connect Moodle to another remote Database system.

The two domains apparently are hosted on the same shared server.

The authentication plugin is working fine when you click Test in its Manage Authentication Plugins

But for Manage Enrolment Plugins, it is returning the following error;

Warning: mysqli_real_connect(): (28000/1045): Access denied for user ’ ic13557d_chisang’@‘localhost’ (using password: YES) in /home/ic021827/public_html/lib/adodb/drivers/adodb-mysqli.inc.php on line 124
Could’t connect :
localhost: Access denied for user ’ ic13557d_chisang’@‘localhost’ (using password: YES)
Cannot connect the database.

I have tried to change password both in phpmysql and the config file but to no avail.
I have indicated the external domain the ip address for the remote database but still not working.

Anyone with the solution, please help me as I cannot find the solution yet!!

Kind regards

Dear Ross,

Please come in.

The two domains/websites are being hosted on the same server with the same IP address.
The testing of the Authentication plugins is working fine and is indicating the fields for remote database using the same username, user password and database name as those for Enrolment plugins

The result of Test settings is as follows:-

Test authentication settings - External database
(mysqli): SELECT * FROM moodleUser WHERE username <> ‘random_unlikely_username’
External table contains following columns:
username, preferredName, surname, email, website

So why is failing for Test Setting in the Enrolment Plugins?

Raphael Chisanga

Hi Raphael, this is an interesting question. I’m not a Moodle user, and built this module as a proof-of-concept some years ago. I’ve not tested it in a while, but believe it should work.

The issue seems to be related to database connections. Can you access command line mysql on the server in question? If so, you could use this to test your connection parameters to try and see where the problem lies.

Let us know if this helps!


Could it be because I am trying to have access remote MySQL connections in cPanel shared hosting ?

How is your suggestion of access command line mysql on the remote server from Windows desktop done? I have tried to Google but I cannot easily get what can for me in this instance.

Any more ideas from the rest of this group?

Raphael Chisanga

Nobody has come up with a solution yet!

I am desperately looking forward to seeing that the Moodle external database enrolment feature works.

The Enrolment failure is now over, I had just retype all the Database-related parameters allover again and the test went through though now it is reporting as follows:

Test enrol settings - External database
(mysqli): SET NAMES’utf8’ (mysqli): SELECT * FROM moodleEnrolment
External enrol table is empty.
(mysqli): SELECT * FROM moodleCourse External course table is empty.

At least there is progress. I just need to check if at all I am referring to the correct external enrol table.

Kind regards

Hi Raphael, well done on solving this problem. I wonder what went wrong. Let us know if you run into any further issues…and sorry we weren’t of more help this time around. Ross.

Hello colleagues. Sorry I got lost into other things. Now I am back on this external database integration issue. I have tried all that I could lay hands on in terms of defining the Authentication and Enrolment plugins in Moodle pointing to Gibbon Database. There tests in Moodle are just okay but the updating of MOODLE users is not happening by importing users that I am creating in Gibbon. How is done then? I have even tried to run the cron.php job in Moodle to no avail . Can some one post all the steps required including the filling out of the two Moodle plugins’ fields. I am very much interested in getting this Project off the ground.
Your prompt response will most be appreciated.

Does it require to run a special job/program to get the Gibbon data across to MOODLE database for Authentication and Enrolment External database plugins to work?

I have run the MOODLE the cron.php job but nothing seems to be exported to MOODLE even when I add a new user into GIBBON system!!! What is the real solution?

Hi chisangaz, I’m not involved with the Moodle side of things, but I may be able to help point you in the direction of those who are. @leofreitas has recently been working on the Moodle side of things and offering some help. Also, here are some recent posts that may get you started:



Hi Sandra.
Let me look thru what you have pointing me to. I will get back,
Kind regards.

Hi Sandra ,
I have tried what has been discussed in the the above three links that you cited but to no avail. The test runs of the two moodle plugins , the Enrolment and Authentication, seems to be going through quite well but the copying of data across from Gibbon database to Moodle database is not working regardless of running the Moodle cron.php job.

Has someone got a full Tutorial on this process?

Kind regards

Hi Raphael,
I could understand that your Moodle installation accesses the Gibbon database without any problems, right? So to identify if there are any problems, you must run the specific cron task in Moodle.

To do this, you need to follow the steps below:

1 - Set the path to PHP CLI (admin/settings.php?section=systempaths)

2 - In Scheduled Tasks (admin/tool/task/scheduledtasks.php) There are two tasks that you can run and check the output.


Good day all and especially leofreitas.

It has been an interesting journey.

At last ,with the final instructions from leofreitas, which are to do with Server System path and Scheduled Tasks settings, the process has finally worked except that the passwords being passed on from Gibbon to Moodle are not working or not being recognised. I used Plain text for Password format in the Authentication External Database Settings field. What should be correct Password format that works in this case?

I just now need to fine tune the fields types/names.

Thanks a lot for all that came through to assist.


Hi chisangaz,

From (distant) memory, I don’t believe passwords will ever work: I think users will need to reset their Moodle password by email, or you’ll need to do a bulk reset. Gibbon’s passwords are hashed and salted, meaning that they are scrambled in a way that is hopefully very hard to unscramble. Moodle uses a different scheme to store passwords. Hence, they are incompatible.

You could use single sign on via Google on both Gibbon and Moodle…



Hi Admin,

I am back, how do I use single sign via Google on both Gibbon and Moodle? . Some tutorial write-up. Please.
I don’t want to Google and get misleading instructions, you are the expert.

Kind regards.

Hi Raphael,

In terms of single sign on for Moodle, we can’t help you, but I am sure the Moodle forums will have people who can.

For Gibbon single sign on from Gibbon, please check out the following user guide from our documentation site:


Good luck, and let us know how you get on!