我托管了我的网站,但是当我点击我的域名时,会显示此消息..
“建立数据库连接时出错”
我想知道我必须为服务器编写配置文件。 和localhost一样?
define('DB_NAME', 'b15951672');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', '');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
答案 0 :(得分:0)
希望它能帮到你,因为它每次都会帮助我服务器。
define('DB_HOST', 'localhost');
define('DB_NAME', 'cpanelUserName_databaseName');
define('DB_USER', 'cpanelUserName_databaseUserName');//Create a user for this database in your server and assign this user for your previously created database.
define('DB_PASSWORD', 'databasePasswordForDBUser'); // This is the password created for "cpanelUserName_databaseUserName"