Hello Everyone,
I am using Moodle 2.8.1, with the Mysqli database. I am trying to access External Database from the moodle by using a select command in mysql. I have given the appropriate information of the External Database in Manage Authentication -> External Database -> Settings . And I have done TestSettings and it shows no error.
The command I have used is:
"SELECT siteid, COUNT(*) FROM users WHERE siteid IS NOT NULL AND siteid <> '' GROUP BY siteid ORDER BY COUNT(*) DESC, siteid ASC "
Where, "users" is the table form external database and siteid is the column form teh "users" table.
Then it shows me the error as below.
So, I understood that the command is searching for the table within the moodle's database. So, I made changes to the command as follows such that it searches for external database.
"SELECT siteid, COUNT(*) FROM main.users WHERE siteid IS NOT NULL AND siteid <> '' GROUP BY siteid ORDER BY COUNT(*) DESC, siteid ASC "
Where, "main" is the external database which has the table "users". AND IT SHOWS THE FOLLOWING ERROR.
But the user it is showing "webuser_training" is not the user of External Database, it is the moodle's database user which is mentioned in the config.php file. So, I duplicated the config.php file with another name which has the details of the external database . I gave the new file as the reference instead of old Config.php. And now it shows be this error.
I am stuck at this point and Have no idea how to proceed forward. Please, Help me out with this. Thanks in advance