MYSQL命令行常用操作

显示数据库                                       mysql->show databases;
创建数据库                                       mysql->create database db;
删除数据库                                       mysql->drop database db;
选择数据库                                       mysql->use db
创建表                                              mysql->create table mytable(name varchar(20),sex(char(1),birth date);
删除表                                              mysql->drop table mytable;
显示表的内容                                   mysql->show tables;
显示表的结构                                   mysql->describe mytable;
在一个表中增加一条字段                mysql->alter table yourtable add id int not null auto_increment, add primary key (id);
删除一个字段                                   mysql->alter table yourtable drop name ;
创建mysql帐户                                mysql> grant all privileges on *.* to '123123'@'localhost'  -> identified by '123123';
                                                          mysql> GRANT SELECT,UPDATE ON *.* TO 'monty'@'%' (可以网络访问的账户) ->   IDENTIFIED BY '123123';
更改已有帐户的密码                        mysql> grant all privileges on *.* to '123123'@'localhost'  -> identified by '123123';  mysql> flush privileges;

posted @ 2011-09-16 19:04  兴百放  阅读(324)  评论(0编辑  收藏  举报