import large MySQL Database - PHPMyAdmin error

2019-03-06 19:09发布

问题:

Trying to import a very large database file. Windows Apache PhpMyAdmin.

USE test;
source somefil.sql;

I get a syntax error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'source somefil.sql' at line 1 "

回答1:

Actually source command is used from command prompt so Use below steps-

Go to command prompt-

connect mysql

now use below command-

source d:/backup/somefil.sql;


回答2:

There is no such command in mysql server as source. This command is specific to mysql own command line client, which is also named mysql, therefore it is not available in phpmyadmin.

Copy-paste the contents of the sql file into the command window of phpmyadmin and execute its contents directly from there. You may have to increase the php max execution time parameter, if the import file is truly big.

However, I would use the command line client to execute a really big sql file because phpmyadmin is not suitable for that.



回答3:

to restor backup of my datebase I use command like that from your os command promt :

mysql -u youruser -p yourdatabasename < yourfilewithfullpath.sql