如何导入.sql文件 [英] How to import a .sql file

查看:143
本文介绍了如何导入.sql文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 10.4 LTS上运行MySQL,不幸的是我在导入sql文件时遇到了严重问题。

I'm running MySQL on Ubuntu 10.4 LTS and unfortunately I've been experiencing serious problems when it comes to importing a sql file.

我实际做了什么:

1)我移动到包含sql文件的目录,该文件名为:bk.sql

1) I move to the directory containing the sql file which is called: bk.sql

2)然后我输入:

mysql -u root -p (然后我输入root密码,一切顺利)

mysql -u root -p (and then I enter the root password and everything goes smoothly)

3)我使用此命令进行导入操作(假设密码= 123m数据库名称= Mydb sql file = bk.sql)

3) I use this command to do the import operation (assuming that password =123m Database name = Mydb sql file = bk.sql)

mysql -u root -p 123m Mydb < bk.sql;

我得到的是:

ERROR 1064 (42000): 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 'mysql -u root 

-p 123m Mydb < bk.sql' at line 1

导入程序是否正确?

推荐答案

看起来你正在从mysql提示符运行mysql import命令,这是不对的。

It looks like you are running the mysql import command from the mysql prompt which is not right.

您不需要执行第2步。只需执行第1步和第3步。

You don't need to do step 2. Just do steps 1 and 3.

这篇关于如何导入.sql文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆