0

第 1 行的 ERROR 1064 (42000):您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册以获取正确使用的语法

在第 1 行

使用以下 mysql 语句时出现错误。mysql -u root -p* * < network.sql

MySQL 服务器版本为 5.5.21

network.sql 文件的内容是

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'server')
    DROP DATABASE [server]
GO

CREATE DATABASE [server]  ON (NAME = N'server', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\server.mdf' , SIZE = 1, FILEGROWTH = 10%) LOG ON (NAME = N'server_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\server_log.LDF' , FILEGROWTH = 10%)
 COLLATE SQL_Latin1_General_CP1_CI_AS
GO

exec sp_dboption N'server', N'autoclose', N'false'
GO

exec sp_dboption N'server', N'bulkcopy', N'false'
GO

exec sp_dboption N'server', N'trunc. log', N'false'
GO

exec sp_dboption N'server', N'torn page detection', N'true'
GO

exec sp_dboption N'server', N'read only', N'false'
GO

exec sp_dboption N'server', N'dbo use', N'false'
GO

exec sp_dboption N'server', N'single', N'false'
GO

exec sp_dboption N'server', N'autoshrink', N'false'
GO

exec sp_dboption N'server', N'ANSI null default', N'false'
GO

exec sp_dboption N'server', N'recursive triggers', N'false'
GO

exec sp_dboption N'server', N'ANSI nulls', N'false'
GO

exec sp_dboption N'server', N'concat null yields null', N'false'
GO

exec sp_dboption N'server', N'cursor close on commit', N'false'
GO

exec sp_dboption N'server', N'default to local cursor', N'false'
GO

exec sp_dboption N'server', N'quoted identifier', N'false'
GO

exec sp_dboption N'server', N'ANSI warnings', N'false'
GO

exec sp_dboption N'server', N'auto create statistics', N'true'
GO

exec sp_dboption N'server', N'auto update statistics', N'true'
GO

use [server]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Connection]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Connection]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[NodeInformation]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[NodeInformation]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pda]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[pda]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[possibledelay]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[possibledelay]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[possiblepath]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[possiblepath]
GO

CREATE TABLE [dbo].[Connection] (
    [NodeName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [Neighbour] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [Cost] [decimal](10, 0) NULL ,
    [Delay] [decimal](18, 0) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NodeInformation] (
    [NodeName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [PortNo] [int] NULL ,
    [SystemName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, 
                [Status] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NodeId] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[pda] (
    [path] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [cost] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [delay] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[node] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL  
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[possibledelay] (
    [destination] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [path] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [delay] [decimal](18, 0) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[possiblepath] (
    [destination] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [path] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [cost] [decimal](10, 0) NULL ,
    [delay] [decimal](18, 0) NULL 

) ON [PRIMARY]
GO
4

2 回答 2

3

您尝试恢复的文件看起来像 MSSQL 的 T-SQL 文件。所以它不适用于MySQL。至少不是原样。

于 2012-04-12T13:12:16.353 回答
0

第一个猜测是它正在从文本文件中获取换行符或 cr 并对其进行攻击。如果您可以从 Windows 框访问数据库,请尝试从查询浏览器运行相同的命令。或者,如果它是一个 linux 机器,您可以在打开所有字符的文本编辑器中打开文件,然后查看无关字符的来源。

于 2012-04-12T13:12:05.870 回答