phpMyAdmin是在線管理MySQL數(shù)據(jù)庫的工具,當(dāng)用它來導(dǎo)入超過2MB的數(shù)據(jù)庫文件時(shí),往往會(huì)因?yàn)槭躊HP.ini上傳文件大小的限制而無法導(dǎo)入。
租用了虛擬主機(jī),沒有服務(wù)器最高管理權(quán)限,無法修改PHP.ini文件,更無法使用命令行該怎么辦?其實(shí)讀讀phpMyAdmin在線幫助文檔,里面早就說明了這個(gè)問題的解決方法。
在phpMyAdmin目錄下新建一個(gè)目錄,如:jonson,再編輯phpMyAdmin目錄下librariesconfig.default.php文件,查找$cfg['UploadDir'],將其值寫為新建目錄的名稱,如下所示:
程序代碼
$cfg['UploadDir'] = 'jonson'; // Directory for uploaded files that can be executed by
// phpMyAdmin. For example './upload'. Leave empty for
// no upload directory support. Use %u for username
// inclusion.
$cfg['SaveDir'] = ''; // Directory where phpMyAdmin can save exported data on
// server. For example './save'. Leave empty for no save
// directory support. Use %u for username inclusion.
$cfg['docSQLDir'] = ''; // Directory for docSQL imports, phpMyAdmin can import
// docSQL files from that directory. For example
// './docSQL'. Leave empty for no docSQL import support.
$cfg['TempDir'] = ''; // Directory where phpMyAdmin can save temporary files.
// This is needed for MS Excel export, see documentation
// how to enable that.
將要導(dǎo)入到數(shù)據(jù)庫的文件上傳到剛才新建的jonson文件夾中,登錄phpMyAdmin,選擇你的數(shù)據(jù)庫,在右側(cè)窗口中點(diǎn)擊“import(導(dǎo)入)”,這時(shí)你會(huì)發(fā)現(xiàn)導(dǎo)入界面中多了一個(gè)“網(wǎng)站服務(wù)器上載目錄”選項(xiàng),點(diǎn)擊下拉箭頭,列表里會(huì)有剛才上傳的文件名稱列表。
選中文件,點(diǎn)擊右下角的“執(zhí)行”按鈕,等待一段時(shí)間(等待的時(shí)間與導(dǎo)入文件體積成正比)即可完成“超重”文件的導(dǎo)入。
更多信息請(qǐng)查看IT技術(shù)專欄