登录命令
mysql -uroot -p21313
新建用户
insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));
刷新权限
flush privileges;
创建数据库
create database 数据库名;
显示数据库
show database;
切换数据库
use 数据库名;
数据库授权
grant all privileges on phplampDB.* to phplamp@localhost identified by ‘1234‘;
grant select,update on phplampDB.* to phplamp@localhost identified by ‘1234‘;
删除用户
DELETE FROM user WHERE User="phplamp" and Host="localhost";
删除数据库
drop database 数据库名;
修改用户密码
update mysql.user set password=password(‘新密码‘) where User="phplamp" and Host="localhost";
原文:http://www.cnblogs.com/liulebao/p/3795329.html