If database connection or timeout issues occur during the install process consider the solutions below.
Issue AValidation Fails
On Step 1 (Pro) and Step 2 (Lite) of the installer you click “Test Database” and get a fail status.
Solution 1Validation Checklist: Double/triple check your user-name and password, this is often overlooked. Make sure the database user has the correct permissions.For example: a read only privilege can’t add data to the database. Check the following list to validate permissions.
- Be sure the database and database user have been created
- Be sure the password matches the database user being used
- Be sure the database user is assigned to the database with the correct permissions
- Temporarly change the database user password to ‘test123’ to validate character input
- Contact your hosting provider for the exact required parameters
Solution 2Hostname Validation: The host input ‘localhost’ works in most cases however it may not on your host so double check with your hosting provider for the exact settings.Often it’s something like mysql.yourname.com or mysql.hostingcompany.com. Sometimes it may even have a port number like “mysql.hostingcompany.com:1400″If you ask your hosting provider they can point you in the right direction. Please seethis site for other various combinations.
If the error message contains something such as “Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)” then it is most likely thatyou don’t have the hostname correct. Please see this forum threadfor an example of how to locate the correct hostname.
Quickest Fix:If you’re on a hosted server contact your provider to make sure your using the exact credentials they need for their servers. Many hosting providershave different ways for how to connect to their databases. Here are the help files to some of the major providers:
Solution 3For issues related to “Error reading database variables” its possible the server is running on a MySQL instance that has “ANSI_QUOTES” enabled by default in their sql mode.When using that SQL mode, MySQL interprets anything in double-quotes as identifiers rather than strings, which most likely causes the issue.To overcome the issue, please remove the ANSI_QUOTES SQL mode.
Issue BAccess Denied
How to fix “Access denied for user ‘myuser’@’localhost’ (using password: YES)” when testing the database connection.
Solution 1In order for the database connection to properly take place a database user but be assigned to the database and granted ‘full privileges’ tothe database. Below are some resources that cover this process:
- The quickest way to validate full level of permissions is to contact your hosting provider.
- This codex covers creating a Database and User.
- For a cPanel demo follow along in this Step-By-Step Video.
GRANT SHOW_ROUTINE ON *.* TO <USER>@<LOCATION>
Solution 2If solution 1 still does not work then try and create a new database user granting full permissions and assigning it to the database. This process can sometimes alleviateany cache issues stored on the database. If the problem still persists contact your host and have them perform the “Basic Troubleshooting” section below to find outwhy the hosting environment is having issues with database user permissions through PHP.
Solution 3When moving a site from one mysql server to another the destination server may not have the correct privileges enabled. In other cases when moving acrossdifferent versions of mysql/mariadb one version may not support the directives of the other version where the database package was built. In those cases you mightsee a message like this:sql=mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privile ...
To work-a-round these issues you have a few options:
- Build in PHP Mode: To avoid any directives that mysqldump generates you can change the build mode to PHP which uses the minimal amount ofmysql/mariadb directives. Simply goto Settings > Packages Tab > SQL Script > “PHP Code”. Then rebuild the package and re-install.
- Modify SQL Script: Advanced In a web browser browse to the installer.php. Then check the file system (via FTP, cPanel, Explorer etc.) a directory named “dup-installer” should be present. Open the database.sql file found inside the dup-installer directory and modify this file so that the directives support the new mysql/mariadb server your on. To do this typically you can remove settings that look like the code block below.Typically its best to only remove the line where you are seeing the errors.
...
So in the event the installer reported an error such as:
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
'Variable 'character_set_client' can't be set to the value of 'NULL'' - [sql=/*!40101 SET character_set_client = @saved_cs_client */;...]
Then you might simply try to remove the last line, save the dup-database_[hash].sql file and run the installer again. If the issue persists checkthe errors till the version of msyql/marida is satisfied with the directives set. If the database engine versions are too far apart then it wouldbe recommend to work with your host or server admin to bring the version closer together.
Issue CDatabase Timeouts
To get around the SQL connection timing out or memory/5xx errors on step 2, you have a couple options when using Duplicator. Currently timeout issues for largedatabase on Duplicator Lite are not supported.
Solution 1Database Chunking
This is a multi-thread process that runs query the database install process over multiple HTTP requests.
- Rebrowse to the installer Step 1 > Advance
- Check Options > Database Tab > Processing > “Chunking Mode”.
- Continue with the install.
- If Option 1 does not work or the SQL chunking option is not available then try option 2.
Solution 2Skip Database Extraction
This process allows users to skip the database table creation process, but still run the database update (step 3) process. This solution requiresthat users to follow the “Quick Steps” or “Advanced Steps” listed below.
- Extract the database.sql from the zipped archive.
- Go to phpAdmin or the equivalent.
- Remove existing database tables. The phpMyAdmin procedure is described here
- Import the database.sql into the chosen database. The phpMyAdmin import procedure isdescribed here
- Browse to the installer fill in values, choose “Skip Database Extraction” in advanced options and run
Do a Manual insert of the database data as follows:
- Build a full package with no database table filters (capture all tables)
- Download the package to your local PC
- Extract the file /dup-installer/dup-installer-data__{hash}.sql from the package
- Compress the dup-installer-data__{hash}.sql file into its own zip file
- Go to your host’s phpMyAdmin or equivalent database management tool (or give to your host to create)
- Delete all tables from the database you have been using on the destination to ensure no duplicate data is found in the next step.For details seethis article.
- Import the zipped database file from step 1.For details see this article.
- Clean out the installer directory other than the installer.php and archive.zip
- Browse to installer.php Step 1 > Action Drop-down > “Skip Database Extraction”
- Continue with the install
Solution 3Duplicator Lite OnlyVersion 1.4.7.2 or earlier
Typically most budget hosts will work with databases under 100MB. Some shared hosts can support databases upto 200MB+. The Lite version only supports a single concurrent thread when trying to create the database. If your host throttles requests or you’re on a shared server that is being heavily utilized by other sites then they might be draining your resources. If step 2 is having issues on Lite we recommend trying some of these options.
- Try running the installer at different times of the day if your on a host that is currently being heavily utilized.
- Change Build Mode: WordPress Admin > Duplicator > Settings > Packages > SQL Script. Some hosts work better with a PHP built SQL Script and others mysqldump.
- Contact your host to see if you can increase their PHP/Web Server timeout limits
- Consider upgrading to Duplicator Pro and trying the SQL file chunk option
TroubleshootIn the even you are unable to isloate a connection issue then troubleshooting with common PHP code can many times isolate the issue. If you are not familiar with coding,provide this solutin to your server admin or hosting provider.
Solution 1The installer uses a very simple PHP function called mysqli_connect to talk to your database. If you believe all the parameters yourentering in the installer are correct, you can validate them by creating a simple file in the same directory as the installer called db-test.php. Then place thefollowing code in the file and fill out the parameters in the mysqli_connect section. This will help isolate if your params are in-deed correct, if you’re unsure ofhow to use the script send it to your host and ask them for help.
<?php// Update the 4 parameters to match your server requirements// Create connection$conn = new mysqli($servername, $username, $password, $dbname);// Check connectionif ($conn->connect_error) { die("Connection failed: " . $conn->connect_error);}echo "Success: A proper connection to MySQL was made! The my_db database is ready to use ." . PHP_EOL;echo "Host information: " . mysqli_get_host_info($conn) . PHP_EOL;?>
* Note: This script is also available in the Duplicator Pro tools directory /plugins/duplicator-pro/tools/db-test.php