要按正常的來操作phpmyadmin還真不能導入導出大文件,不過我們可以通過其它辦法如果修改php.ini或創(chuàng)建一個另外目錄
大家常用的辦法,phpMyAdmin 不能導入大文件,在命令行下用下面的.
命令導入:mysql -u <用戶名> -p<密碼> <數(shù)據(jù)庫名稱> < <SQL文件名稱>
例如:mysql -u root -p123456 box < box.sql
上面這辦法得有服務器權限或要以遠程連接到你的mysql數(shù)據(jù)庫,如果你有服務器權限好辦,修改php.php的配置文件,修改下面兩項:post_max_size = 8M,表單提交的最大限制,此項不是限制上傳單個文件的大小,而是針對整個表單提交的數(shù)據(jù)進行限制,代碼如下:
upload_max_filesize = 2M
上傳的單個文件的最大限制,這樣就解決了不是么.
下面看另一解決方法:
在phpMyAdmin目錄下新建一個目錄,如:mysqldata,再編輯phpMyAdmin目錄下config.default.php文件,查找$cfg[’UploadDir’],將其值寫為新建目錄的名稱,如下所示:
- $cfg['UploadDir'] = 'mysqldata'; // 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. --Vevb.com
- // This is needed for MS Excel export, see documentation
- // how to enable that.
將要導入到數(shù)據(jù)庫的文件上傳到剛才新建的mysqldata文件夾中,登錄phpMyAdmin,選擇你的數(shù)據(jù)庫,在右側(cè)窗口中點擊“import(導入)”,這時你會發(fā)現(xiàn)導入界面中多了一個“網(wǎng)站服務器上載目錄”選項,點擊下拉箭頭.
列表里會有剛才上傳的文件名稱列表,選中文件,點擊右下角的“執(zhí)行”按鈕,等待一段時間(等待的時間與導入文件體積成正比)即可完成“超重”文件的導入.
好了這個辦法在沒有服務器權限可以操作.
新聞熱點
疑難解答
圖片精選