mysql运行sql文件效率_在MySQL中运行.sql文件

bd96500e110b49cbb3cd949968f18be7.png

This question is based on this thread.

I run unsuccessfully

sudo mysql

\. /users/cs/SO_db/posts.sql

I get the error

ERROR 1146 (42S02): Table 'personal.posts' doesn't exist

A five-character SQLSTATE value

('42S02'). The values are specified by

ANSI SQL and ODBC and are more

standardized. Not all MySQL error

numbers are mapped to SQLSTATE error

codes. The value 'HY000' (general

error) is used for unmapped errors.

and

Error: 1146 SQLSTATE: 42S02

(ER_NO_SUCH_TABLE)

Message: Table '%s.%s' doesn't exist

How can you solve the error message?

解决方案

As I mentioned in the post you referenced, you NEED to create the tables first.

Peek at the XML or the SQL output on what columns you need. e.g. here is a table that can hold the output from badges.xml (I don't have the others available right now..)

CREATE TABLE `badges` (

`Id` int(11) NOT NULL default '0',

`UserId` int(11) not NULL,

`Date` datetime not NULL,

`Name` varchar(32) not NULL,

PRIMARY KEY (`Id`),

KEY `Date` (`Date`),

KEY `UserId` (`UserId`)

) ;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值