mysql 基本操作

1  安装时将字符集设为gbk

2  查看有哪些数据库    show databases

    查看有哪些表      show tables

    查看当前用户        select user()

3  更改字段名称       alter table table_name  change  col_old col_new varchar(10)(属性)

   更改字段属性               alter tabel table_name  modify  col_name  varchar(10)(属性)

 

    添加字段        alter table table_name add col_name NOT NULL

    删除字段       alter table table drop col_name

 

4  替换字符串        update table_name set col_name=replace(col_name,'str_new','str_old')

posted @ 2014-03-16 15:41  aldin  阅读(110)  评论(0编辑  收藏  举报