2012-01-12 14 views
-1

我沒有權限修改php.ini,但使用SSH,而在phpmyadmin中,我只能輸入文件最大2M。但是現在我有一個很大的數據庫,所以我可以使用SSH輸入大尺寸的mysql數據庫而不需要修改php.ini如何使用SSH輸入mysql數據庫?

put c:/mydata.sql /etc/local/mydata.sql {where is the folder I should upload?} 
mysql -u myname -p 
mypassword: 
mysql>use mydata; 
mysql>... { what is the insert code, it may be depand the fold where I update to the server } 

如果此方法仍然有2M max的限制,我該怎麼辦?

+1

嘗試http://www.google.com/search?q=mysql+import+dump – 2012-01-12 10:47:05

回答

1

進口導入:

gunzip < dump.sql.gz | mysql --user=DB_USER --password DB_NAME 
:從壓縮文件

mysql --user=DB_USER --password DB_NAME < dump.sql 

進口

從另一個主機上的壓縮文件導入(比'localhost'):

gunzip < dump.sql.gz | mysql --host=your.db.server.com --user=DB_USER --password DB_NAME 

我不會在命令行上的密碼,因爲它會被存儲在bash的歷史,剛剛離開--password - 選項不實際的密碼和MySQL將進行提示。如果你不指定這個選項,mysql將嘗試登錄而不使用密碼。

對於你的其他問題,在哪裏上傳你的SQL文件:你應該知道,如果在服務器上做任何事情......或者只是使用上面建議的temp-dir或者在你的webroot之外創建一個備份文件夾。

0

如果您有ssh訪問權限,則使用scp工具將您的文件複製到目標server.I認爲如果您不知道目錄,請使用/ tmp位置。

scp /local/path/to/file.sql [email protected]:/tmp 

輸入密碼和文件應該被複制到服務器上的/ tmp目錄下,然後你可以從文件

相關問題