[英]Restoring old database in Mysql
I am trying to restore an old database (from 2009) using phpMyAdmin. 我正在尝试使用phpMyAdmin还原旧数据库(从2009年开始)。 I get the following error:
我收到以下错误:
#1064 - 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 'not_null primary_key auto_increment, `Owned` int(11) not_null, `Owner` int' at line 2
I googled the error but couldn't find a solution. 我在错误中进行了搜索,但找不到解决方案。 I understand something has changed with MySQL over years, but what should i do?
我了解MySQL多年来已经发生了一些变化,但是我应该怎么办?
My query is as follows: 我的查询如下:
CREATE TABLE `aautod` (
`aAutoId` int(11) not_null primary_key auto_increment,
`Owned` int(11) not_null,
`Owner` int(11) not_null,
`Description` string(64) not_null,
`Model` int(11) not_null,
`Value` int(11) not_null,
`Locked` int(11) not_null,
`ColorOne` int(11) not_null,
`ColorTwo` int(11) not_null,
`License` string(100) not_null,
`Locationx` real(12) not_null,
`Locationy` real(12) not_null,
`Locationz` real(12) not_null,
`Angle` real(12) not_null,
`Parked` real(12) not_null,
`ParkLocationx` real(12) not_null,
`ParkLocationy` real(12) not_null,
`ParkLocationz` real(12) not_null,
`ParkAngle` real(12) not_null,
`GPS` int(11) not_null,
`Color1` int(11) not_null,
`Color2` int(11) not_nul,
PRIMARY KEY (`aAutoId`)
) TYPE=MyISAM DEFAULT CHARSET=latin1;
You have multiple errors: 您有多个错误:
As has already been pointed out not_null
should be not null
. 正如已经指出的,
not_null
不应该为not null
。 As well as primary_key
should be primary key
. 以及
primary_key
应该是primary key
。
I changed string(xx)
to varchar
我将
string(xx)
更改为varchar
http://dev.mysql.com/doc/refman/5.5/en//string-types.html http://dev.mysql.com/doc/refman/5.5/en//string-types.html
real(xx)
takes two arguments, not 1. The second argument is how many decimals places are after the decimal point. real(xx)
接受两个参数,而不是1。第二个参数是小数点后的小数位数。
http://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html http://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html
type=MyISAM
was changed to Engine=MyIsam
type=MyISAM
已更改为Engine=MyIsam
You also defined your primary key twice, once on the first line declaration and on the last line of the table declaration. 您还定义了两次主键,一次在表声明的第一行,最后一行。 I changed to this to declare it only once.
我更改为仅声明一次。
CREATE TABLE `aautod` (
`aAutoId` int(11) not null primary key auto_increment,
`Owned` int(11) not null,
`Owner` int(11) not null,
`Description` varchar(64) not null,
`Model` int(11) not null,
`Value` int(11) not null,
`Locked` int(11) not null,
`ColorOne` int(11) not null,
`ColorTwo` int(11) not null,
`License` varchar(100) not null,
`Locationx` real(12,11) not null,
`Locationy` real(12,11) not null,
`Locationz` real(12,11) not null,
`Angle` real(12,11) not null,
`Parked` real(12,11) not null,
`ParkLocationx` real(12,11) not null,
`ParkLocationy` real(12, 11) not null,
`ParkLocationz` real(12, 11) not null,
`ParkAngle` real(12, 11) not null,
`GPS` int(11) not null,
`Color1` int(11) not null,
`Color2` int(11) not null
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
它应该是两个单独的单词: NOT NULL
, PRIMARY KEY
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.