Problem cloning database

Problem cloning database

by Daniel Rodriguez -
Number of replies: 3

Hello,


I have a cloned moodle, one for the development environment and one for the production environment.

I have a database that works in dev and pro perfectly, I try to clone the database so that each environment has its own database.

These are the steps I follow to clone and restore the database.


mysqldump -u user -p database> database.sql


mysql -u user -p database <database


I grant user permissions on the database.


When I change the setting in config.php to point to the new database, the install screen is displayed and it doesn't work.

Is there something that needs to change?

I have also checked

SHOW GLOBAL VARIABLES WHERE variable_name IN ('innodb_file_format', 'innodb_large_prefix', 'innodb_file_per_table');

and is set to Barracuda, ON, ON.


I make it clear that the original database works on the two moodle sites since they are the same.


The moodle version is Moodle 3.10.1+ (Build: 20210211).


Thanks for the help.

Greetings.

Average of ratings: -
In reply to Daniel Rodriguez

Re: Problem cloning database

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Moodle calls a function – core_tables_exist() – to check if its database is present. The install page is shown if this check fails. The checks are:

  1. Look for any Moodle tables: SHOW TABLES LIKE 'mdl_%'.
  2. Look for three specific tables: mdl_config, mdl_course and mdl_groupings.

To manually run these checks: connect to MySQL using the username and password from $CFG->dbname/$CFG->dbpass, switch to the database $CFG->dbname, and run the query to check for these tables:

$ mysql -u dbuser -p dbname
> SHOW TABLES LIKE 'mdl_%'

Change 'mdl_' if you're using a different $CFG->prefix.

This thread contains the same problem where the cause was the user have a . "dot" inside its name […] with MySQL 8.x generate the problem.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Problem cloning database

by Daniel Rodriguez -
Hi, thanks for your response.
I already checked the database and everything was correct.
I have gone through the tables you mention and all three tables exist.
The access data to the database is correct, I only modify the name of the database in config.php.
Any other idea?
For now I have forgotten about this problem, later I will make a full backup of the moodle and the database again.
But I would like to know what is the problem that produces this error.

Thanks!