初次用PHPCMS V9的朋友可能找不到數(shù)據(jù)庫(kù)配置文件,其實(shí)在官方的wiki中已經(jīng)介紹了。那就是 caches\configs\database.php 文件。
在本地做好了網(wǎng)站之后,上傳到服務(wù)器上,就要修改caches\configs\database.php 文件才能正常訪問(wèn)數(shù)據(jù)庫(kù),否則會(huì)出現(xiàn)如下錯(cuò)誤信息:
MySQL Query :
MySQL Error :
MySQL Errno : 0
Can not connect to MySQL server
打開(kāi)database.php文件代碼如下:
<?php
return array (
'default' => array (
'hostname' => 'localhost', //服務(wù)器名稱(chēng)
'database' => 'phpcmsv9', //數(shù)據(jù)庫(kù)名
'username' => 'root', //數(shù)據(jù)庫(kù)用戶名
'password' => '88888888', //密碼
'tablepre' => 'pc9_', //數(shù)據(jù)庫(kù)前綴,可以是任意,如沒(méi)特殊要求
'charset' => 'utf8', //數(shù)據(jù)庫(kù)字符集
'type' => 'mysql', //數(shù)據(jù)庫(kù)類(lèi)型
'debug' => true, //是否開(kāi)啟錯(cuò)誤提示
'pconnect' => 0, //是否永久連接數(shù)據(jù)庫(kù) 0,不是 1,是
'autoconnect' => 0
),
);
?>
修改其中的hostname,database,username和password值內(nèi)容為服務(wù)器相關(guān)的值就可以了。