If you use web hosting to run a Discuz! forum, you may be unable to access it after changing the database password. This issue can occur if you update the password in the management console without also updating the website's configuration file. This topic describes how to resolve this issue.
Symptom
After you change the database password for your Discuz! forum on a web hosting instance, you receive a Discuz! Database Error message when you try to access the forum. The error details are similar to the following:
Discuz! Database Error
(1045) notconnect
PHP Debug
No. File Line Code
1 forum.php 56 discuz_application->init()
2 source/class/discuz/discuz_application.php 65 discuz_application->_init_db()
3 source/class/discuz/discuz_application.php 399 discuz_database::init(%s, Array)
4 source/class/discuz/discuz_database.php 23 db_driver_mysql->connect()
5 source/class/db/db_driver_mysql.php 75 db_driver_mysql->_dbconnect(%s, %s, %s, %s, %s, %s)
6 source/class/db/db_driver_mysql.php 88 db_driver_mysql->halt(%s, %d)
7 source/class/db/db_driver_mysql.php 224 break()
Possible cause
You changed the database password in the management console but did not update the password in the website's configuration file.
Resolution
-
Download the configuration file (
config_global.php) to your local host.Download the
config_global.phpfile from the/htdocs/configsite directory on your web hosting instance to your local host. For detailed steps, see Upload or download website program files. -
Modify the database connection information in the
config_global.phpfile.-
Use a text editor, such as EditPlus, to open the
config_global.phpfile. -
Modify the database connection information in the file.
In the file, replace the value of the
dbpwparameter with the new password you set in the management console. The following code shows an example of the configuration file:// ---------------------------- CONFIG DB ----------------------------- // $_config['db']['1']['dbhost'] = 'your_database_endpoint'; $_config['db']['1']['dbuser'] = 'your_database_account'; $_config['db']['1']['dbpw'] = 'your_new_database_password'; $_config['db']['1']['dbcharset'] = 'utf8'; $_config['db']['1']['pconnect'] = '0'; $_config['db']['1']['dbname'] = 'your_database_name'; $_config['db']['1']['tablepre'] = 'pretest_'; $_config['db']['slave'] = ''; $_config['db']['common']['slave_except_table'] = ''; -
Save your changes and close the text editor.
-
-
Upload the modified
config_global.phpfile to your web hosting instance.Use an FTP client to upload the file to the
/htdocs/configdirectory on your web hosting instance. For detailed steps, see Upload or download website program files. -
Access your Discuz! forum again to verify that the issue is resolved.
If the issue persists, submit a ticket for assistance.