基本知识方便操作
//创建数据库
create database databasename;
//进入数据库
use databasename;
//显示表名(可以通过这个语句查看表数量,从而判断是否导入错误)
show tables;
//在进入数据库之前显示所有表
show tables from databasename;
//创建表
create table 表名 (
id INT NOT NULL AUTO_INCREMENT,
content VARCHAR(100) NOT NULL,
PRIMARY KEY ( id )
);
//查看表结构
describe '表名';
//删除表
drop table ‘表名’;
//添加字段
ALERT TABLE test ADD COLUMN log VARCHAR(100) NOT NULL AFTER content;
//修改字段
ALTER TABLE `数据库名`.`表名` CHANGE `当前字段` `新字段` VARCHAR( 11 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `数据库名`.`表名` CHANGE `当前字段` `新字段` VARCHAR( 11 ) NOT NULL;
//删除字段
ALTER TABLE `数据库名`.`表名` DROP COLUMN `字段`;
//清楚表数据
TRUNCATE TABLE `数据库`.`表名`;
可以通过phpmyadmin进行操作