如何通过命令行在Windows上使用mysqldump导入SQL文件

时间:2021-09-26 09:47:43

How do I import an SQL file to MySQL dump using command line. I am using windows.

如何使用命令行将SQL文件导入MySQL转储。我正在使用Windows。

5 个解决方案

#1


20  

Navigate to the directory where you have mysql and issue this command, changing the bold values to your file/database locations.

导航到您拥有mysql的目录并发出此命令,将粗体值更改为文件/数据库位置。

c:\mysql\bin\> mysql -u USERNAME -p PASSWORD database_name < filename.sql

#2


1  

Simple steps to import sql file.

导入sql文件的简单步骤。

Click on WampServer and then go to MySQL=> MySQL console enter password \If no password click simply enter create database database_name; \If database already there skip this step use database_name; source D:\backup.sql \Path of database file

单击WampServer然后转到MySQL => MySQL控制台输入密码\如果没有密码,请单击“输入create database database_name”; \如果数据库已经跳过此步骤使用database_name;源D:\ backup.sql \数据库文件的路径

#3


0  

To dump all databases, use the -all-databases option. With that option, no database needs to be specified.

要转储所有数据库,请使用-all-databases选项。使用该选项,不需要指定数据库。

mysqldump -u username -ppassword –all-databases > dump.sql

#4


0  

Try like this:

试试这样:

I think you need to use the full path at the command line, something like this, perhaps:

我认为您需要在命令行使用完整路径,可能是这样的:

C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < file_name.sql

Refer this link also:

请参阅此链接:

http://www.ryantetek.com/2011/09/importing-large-sql-files-through-command-line-when-using-phpmyadminxampp/

http://www.ryantetek.com/2011/09/importing-large-sql-files-through-command-line-when-using-phpmyadminxampp/

#5


0  

Try this

尝试这个

C:\Program Files\Mysql\Mysql server 5.6\bin\mysql -u {username} -p {password} {your database name} < file-name.sql

Note here file-name.sql is in mysql server 5.6\bin

注意这里file-name.sql在mysql server 5.6 \ bin中

#1


20  

Navigate to the directory where you have mysql and issue this command, changing the bold values to your file/database locations.

导航到您拥有mysql的目录并发出此命令,将粗体值更改为文件/数据库位置。

c:\mysql\bin\> mysql -u USERNAME -p PASSWORD database_name < filename.sql

#2


1  

Simple steps to import sql file.

导入sql文件的简单步骤。

Click on WampServer and then go to MySQL=> MySQL console enter password \If no password click simply enter create database database_name; \If database already there skip this step use database_name; source D:\backup.sql \Path of database file

单击WampServer然后转到MySQL => MySQL控制台输入密码\如果没有密码,请单击“输入create database database_name”; \如果数据库已经跳过此步骤使用database_name;源D:\ backup.sql \数据库文件的路径

#3


0  

To dump all databases, use the -all-databases option. With that option, no database needs to be specified.

要转储所有数据库,请使用-all-databases选项。使用该选项,不需要指定数据库。

mysqldump -u username -ppassword –all-databases > dump.sql

#4


0  

Try like this:

试试这样:

I think you need to use the full path at the command line, something like this, perhaps:

我认为您需要在命令行使用完整路径,可能是这样的:

C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < file_name.sql

Refer this link also:

请参阅此链接:

http://www.ryantetek.com/2011/09/importing-large-sql-files-through-command-line-when-using-phpmyadminxampp/

http://www.ryantetek.com/2011/09/importing-large-sql-files-through-command-line-when-using-phpmyadminxampp/

#5


0  

Try this

尝试这个

C:\Program Files\Mysql\Mysql server 5.6\bin\mysql -u {username} -p {password} {your database name} < file-name.sql

Note here file-name.sql is in mysql server 5.6\bin

注意这里file-name.sql在mysql server 5.6 \ bin中