[英]Restoring old database in Mysql
我正在嘗試使用phpMyAdmin還原舊數據庫(從2009年開始)。 我收到以下錯誤:
#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
我在錯誤中進行了搜索,但找不到解決方案。 我了解MySQL多年來已經發生了一些變化,但是我應該怎么辦?
我的查詢如下:
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;
您有多個錯誤:
正如已經指出的, not_null
不應該為not null
。 以及primary_key
應該是primary key
。
我將string(xx)
更改為varchar
http://dev.mysql.com/doc/refman/5.5/en//string-types.html
real(xx)
接受兩個參數,而不是1。第二個參數是小數點后的小數位數。
http://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html
type=MyISAM
已更改為Engine=MyIsam
您還定義了兩次主鍵,一次在表聲明的第一行,最后一行。 我更改為僅聲明一次。
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.