alter table test rename test1; --修改表名alter table test add column name varchar(10); --添加表列alter table test drop column name; --删除表列alter table test modify address char(10) --修改表列类型||alter table test change address address char(40)alter table test change column address address1 varchar(30)--修改表列名
set names utf8;用于设定数据库编码,让中文可以正常显示。
1.创建数据库:CREATE DATABASE `database` CHARACTER SET 'utf8' COLLATE 'utf8_general_ci '; 2.创建表:CREATE TABLE `database_user` ( `ID` varchar(40) NOT NULL default ' ', `UserID` varchar(40) NOT NULL default ' ', ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 3.设置URL时: jdbc:mysql://localhost/database?seUnicode=true;characterEncoding=UTF-8 修改数据库默认编码:ALTER DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin 修改表的编码:ALTER TABLE `category` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin