代码改变世界

Mysql使用笔记

2011-06-01 14:40  hanwesley  阅读(301)  评论(0编辑  收藏  举报

一、建表错误

在Mysql6.0中执行:create table JBPM_BYTEARRAY (ID_ bigint not null auto_increment, NAME_ varchar(255), FILEDEFINITION_ bigint, primary key (ID_)) type=InnoDB; 
出现错误: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 'type=InnoDB' at line 1, 

解决办法:type=InnoDB 修改为ENGINE=InnoDB

show databases;

use databasename;

show tables;

describe tablename;

本地文件load至表

LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;

If you created the file on Windows with an editor that uses \r\n as a line terminator, you should use this statement instead:

mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet
    -> LINES TERMINATED BY '\r\n';

(On an Apple machine running OS X, you would likely want to use LINES TERMINATED BY '\r'.)