日期:2014-05-16  浏览次数:20709 次

mysql 基本操作命令

1.         查看端口

             Netstat –an

2.         登陆mysql服务器

             Mysql –u root –p         mysql–hlocahost –u root –p

3.         选择数据库

            Show databases  

4.         设置字符集

            set names 'gbk';

5.         查询数据库中的表

             show tables;

6.      设置字符集

             set names'gbk';

7.      创建表

          create tabletest(

          tid int(10) not null,

          tname varchar(100) notnull,

          tdate datetime not null default'0000-00-00',

          primary key(tid));

8.         查看表结构

          desc test;

9.         增加列

          alter table testadd(tage int(3));

10.      修改列的默认值

          alter table test altertag set default '0';