phpMyAdmin是在線管理MySQL數據庫的工具,當用它來導入超過2MB的數據庫文件時,往往會因為受PHP.ini上傳文件大小的限制而無法導入。
租用了虛擬主機,沒有服務器最高管理權限,無法修改PHP.ini文件,更無法使用命令行該怎麼辦?其實讀讀phpMyAdmin在線幫助文檔,裡面早就說明了這個問題的解決方法。
在phpMyAdmin目錄下新建一個目錄,如:jonson,再編輯phpMyAdmin目錄下libraries\config.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