305: Dealing with Database Errors in PHP-Fusion
Occasionally, there is the need to move or migrate a PHP-Fusion installation. With the move there is a risk of getting the information for the database server set wrong, or there might be a problem with the SQL server. The following articles describes the database errors that you may see when encountering these issues with a PHP-Fusion installation.
Understanding Database Errors in PHP-Fusion
Database Connection Errors
Database Connection errors differ from authorization errors in that the error specifically states that it cannot connect through the network services used to connect to the database. Here's an example of a connection error:
This can mean that the database server is down and not running or the network connection is not allowing a connection server. Note that the database connection service is not operational is different from the server not running. This is also different from having the incorrect database information in the configuration file being unable to connect to the server - an authorization issue that is related database user name, password or database name issues.
How do I tell if my MYSQL server is not working?
Checking a VPS or Dedicated Server
The status of a MYSQL server can be directly determined only if you have access to the Web Host Manager (WHM) or root access to the server via a terminal client. Access to these options are only going to be available with a VPS or Dedicated server. When you have access to the secure shell terminal, the status messages for the server will look like this:
This error indicates that the service is running:
This error indicates that service is not running or service is unavailable:
If you are in the Web Host Manager (WHM), then you can also check Services to see if MYSQL services have been selected or phpMyAdmin to see if it will make a connection. If phpMyAdmin generates an error, then the mySQL service is not running. For more information on seeing if your SQL server is running, go to the article named Database connection error, or contact our Live Technical Support team available 24/7.
Checking a Shared Server
If you are on a shared server, you can also check the status of your server by simply looking at either the MySQL Database icon or by clicking on the phpMyAdmin service. If the service is not connected, then you will see an error appear (regardless of the login information that you use).
Database Connection Errors Caused by Database Authorization Errors
Authorization errrors are different from connection errors in that they specifically have to do with the incorrect database user, database password or database name being used in the parameters to connect to the database server. Here are some of the error messages that you may see:
These type of errors are easily corrected if you have access to config.php file. The following directions take you through editing the values in the config.php file using the Cpanel File Manager):
- Log into cPanel
- Scroll down the Files section and Click on the FILE MANAGER icon.
- Navigate in the File Manager until you get to the root of the PHP-Fusion installation files. Scroll down the list of files until youFind the CONFIG.PHP. Click to highlight the CONFIG.PHP file, then click on CODE EDIT in the top of the File Manager.
- When you edit the file you will be looking for all the database parameters to make sure that they are correct. These parameters include: database host (db_host), database user name (db_user), database password (db_pass), and the database name (db_name). If any of these parameters are misspelled or incorrect, then a database error will occur.
- Click on SAVE CHANGES in the top right hand corner to save any changes you may have made with the CONFIG.PHP file.
Database errors can appear mysterious and probably frightening to any novice who has not had much exposure to the way the PHP-Fusion (or any other database-backed program) works. However, with a little understanding of the helpful error messages, the problem can most likely be rapidly fixed. If you require assistance with checking on your database server or if you must make changes, please do not hesitate to contact the InMotion Hosting Technical Support team available 24/7.