1、登陆mysql
mysql -p -u user
2、打开数据库
mysql> use mydb;
3、列出全部数据表
mysql> show tables;
4、显示表结构
mysql> describe mytable;
5、查询表记录
mysql> select * from mytable where id > 100 order by id desc\G
6、table添加一列
mysql> alter table mytable add newcolumn tinyint default 0;
7、table修改一列
mysql> alter table mytable modify column col_name tinyint default 0;
8、table列改名
alter table mytable rename column old_column_name to new_column_name;
9、把表中一列复制给另一列
update mytable set newcol = oldcol;