Error reading from database Moodle 3.5 when install

Error reading from database Moodle 3.5 when install

Gokulan N發表於
Number of replies: 27

Hi,

I tried to install Moodle in localhost using WAMP 3.1.3 64Bit. And I'm using PHP version 7.0.29, MySQL version 5.7.21 (or MariaDB 10.2.14). But I'm unable to install Moodle on this. It says "Error reading from database" when I install. Below screen shows to me. 

Can anyone please help me to fix this and install successfully???


moodle error

評比平均分數: -
In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Rick Jerz發表於
Particularly helpful Moodlers的相片 Testers的相片

I am not the expert on this, but maybe I can get you started.

Are you sure that the database is running?  Have you started Apache and MySQL in your WAMP?

Are you sure that you entered the correct database username and password?

How, or maybe a better question, did you create a database before running moodle's install?

In reply to Rick Jerz

Re: Error reading from database Moodle 3.5 when install

Gokulan N發表於

First thanks for your response.

Are you sure that the database is running?

Yes. I've checked that. It's working. 

Have you started Apache and MySQL in your WAMP?

Yes. Everything is running.

Are you sure that you entered the correct database username and password?

Yes. I'm sure. I've checked many times

Did you create a database before running moodle's install?

Yes. I did.


I've checked old posts for solutions. And I tried that too. But nothing works....


In reply to Rick Jerz

Re: Error reading from database Moodle 3.5 when install

Gokulan N發表於

And below is my config file


unset($CFG);

global $CFG;

$CFG = new stdClass();


$CFG->dbtype    = 'mysqli';

$CFG->dblibrary = 'native';

$CFG->dbhost    = 'localhost';

$CFG->dbname    = 'moodle';

$CFG->dbuser    = 'root';

$CFG->dbpass    = '';

$CFG->prefix    = 'mdl_';

$CFG->dboptions = array (

  'dbpersist' => 0,

  'dbport' => 3306,

  'dbsocket' => '',

  'dbcollation' => 'utf8mb4_unicode_ci',

);

$CFG->wwwroot   = 'http://localhost/moodle';

$CFG->dataroot  = 'E:\\wamp64\\moodledata';

$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(__DIR__ . '/lib/setup.php');

In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Alain Raap發表於
Particularly helpful Moodlers的相片

Could you share some information of your database logfile? Usually it gives some more information about the error you get.   

In reply to Alain Raap

Re: Error reading from database Moodle 3.5 when install

Gokulan N發表於

I checked that log file. But nothing inside related to this issue. In fact, I checked all the log files. But i can't find anything related to this

In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Alain Raap發表於
Particularly helpful Moodlers的相片

Did you try dbtype "mariadb"? Can you reach the database with mysql command as root?

In reply to Rick Jerz

Re: Error reading from database trying to upgrade 3.8 to 3,9

Fatima Shaikh發表於

I am also facing the same problem when I tried to upgrade moodle 3.8 to 3.9.

Please help me resolve the problem.

Thanks & regards

Fatima 

(Edited by Mary Cooch  to change subject title- original submission Tuesday, 16 June 2020, 7:33 AM)


In reply to Fatima Shaikh

Re: Error reading from database trying to upgrade moodle 3.8 to 3.9

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
Can you access the database with the dbuser and dbpass in the config.php? The usual tools are either phpMyAdmin or the mysql command line tool.

P.S. Yours is not the same problem as the original thread you joined https://moodle.org/mod/forum/discuss.php?d=374827. I changed the subject line accordingly.
In reply to Visvanath Ratnaweera

Re: Error reading from database trying to upgrade moodle 3.8 to 3.9

Fatima Shaikh發表於
Thanks for the prompt reply. Will check.
In reply to Fatima Shaikh

Re: Error reading from database trying to upgrade moodle 3.8 to 3.9

Fatima Shaikh發表於
I can access the database through dbuser & dbpass.
In reply to Fatima Shaikh

Re: Error reading from database trying to upgrade moodle 3.8 to 3.9

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
The error message is exactly that in the post https://moodle.org/mod/forum/discuss.php?d=374827, i.e. "It is not possible to recover from errors triggered during installation, you may need to create a new database or use a different database prefix if you want to retry installation"?

That is really odd. It talks about a fresh installation but you said, you are trying to upgrade? You have to give exact steps you have done, ideally in the form of documentation. e.g. https://docs.moodle.org/39/en/Upgrading#Linux ?
In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Emma Richardson發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

I suggest trying what the message says.  Delete your database, create a new one and try again.

In reply to Emma Richardson

Re: Error reading from database Moodle 3.5 when install

Gokulan N發表於

Actually, i tried that. But nothing works

In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Emma Richardson發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

What is your database server?  Let's start there - is it mysql or mariadb?

Does the user you created have the necessary permissions on the database (read,write, etc)?

That error suggests that you are connecting the database server but something is wrong with the database itself.  

Did you go through the specific instructions for whatever database you have found here: 

https://docs.moodle.org/35/en/Installing_Moodle#Create_an_empty_database

 

 

In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Ste Crz發表於

For those still getting the "error reading from database" message: I changed 'dbcollation' in the moodle config file (config.php) from 'utf8mb4_unicode_ci' to 'utf8_general_ci' and now it works.

Probably would be better to change the database encoding instead of moodle settings but my host does not allow the change.

In reply to Ste Crz

Re: Error reading from database Moodle 3.5 when install

Collins Jumah發表於

Thanks for the solution,,,,, it has been an error for a whole week.... after transferring moodle files to cpanel wit its database.

In reply to Ste Crz

Re: Error reading from database Moodle 3.5 when install

David Cardona發表於

Oh man, you saved me hours!!, I was having too the "error reading from database"  when creating a new user on moodle 3.7.2 , i made the change you suggested and everything is working now.

But, which could be the implications of changing the dbcollation on a production site?

In reply to Ste Crz

Ang: Re: Error reading from database Moodle 3.5 when install

Preben Pedersen發表於

The 'utf8_general_ci' doesn't support emoji etc. So i went it 'utf8mb4_general_ci' which solved my problem.

In reply to Ste Crz

Re: Error reading from database Moodle 3.5 when install

Ashraf Mousa發表於
I already solve this problem by correct the config.php file to match the database from "utf8mb4_unicode_ci" to "utf8_bin" because I made my database as "utf8_bin", so anyone who faces this problem should try this solution.
In reply to Ashraf Mousa

Re: Error reading from database Moodle 3.5 when install

Jeff Lewis發表於
I found a similar fix here. I kept getting the error when trying to add a New User or change the email address of a User. Not sure if Softaculous update from 10.5 to 11 was to blame, since hadn't tried to add/update any users from 3.11 through to our latest 3.11.4 incremental updates.

In our case, the dbcollation was 'utf8mb4_unicode_ci', so I simply changed it to 'utf8_unicode_ci'
In reply to Jeff Lewis

Re: Error reading from database Moodle 3.5 when install

Jeff Lewis發表於
Unfortunately, removing "mb4" from the dbcollation is not a perfect fix.  It resulted in the following Server check issue:

"mysql_full_unicode_support if this test fails, it indicates a potential problem

The current setup of MySQL or MariaDB is using 'utf8'. This character set does not support four byte characters which include some emoji. Trying to use these characters will result in an error when updating a record, and any information being sent to the database will be lost. Please consider changing your settings to 'utf8mb4'. See the documentation for full details. "
Other Check error from editing config.php dbcollation
In reply to Gokulan N

Re: Error reading from database Moodle 3.5 when install

Syed Khalid Mehmood發表於
I faced the same issue, But it was due to low disk space on the server where I have diploid my Moodle setup

I resolved it by removing extra files from server