我试图使用命令行将表添加到 MySQL 中的数据库:
mysql -u Jon -p testdb --password=password < "C:\Users\Jon\Documents\Summer\Do\SQL\root.sql"
但是,当我输入上述内容时出现错误:
ERROR 1064 (42000) at line 12: 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 'VARCHAR(255) DEFAULT NULL, Clearing VARCHAR(255) DEFAULT NULL, Globex VARCH' at line 2
我使用 dbForge 创建了一个名为的 sql 文件root.sql
:
SET NAMES 'utf8';
USE testdb;
DROP TABLE IF EXISTS roottable;
CREATE TABLE roottable
(
ProductName VARCHAR(255) DEFAULT NULL,
Clearing VARCHAR(255) DEFAULT NULL,
Globex VARCHAR(255) DEFAULT NULL,
IsActive VARCHAR(255) DEFAULT NULL,
FloorId VARCHAR(255) DEFAULT NULL,
GroupId VARCHAR(255) DEFAULT NULL,
SubGroup VARCHAR(255) DEFAULT NULL,
ConversionFactor VARCHAR(255) DEFAULT NULL,
Id INT PRIMARY KEY AUTO_INCREMENT
)
ENGINE = INNODB
CHARACTER SET utf8
COLLATE utf8_general_ci;