【笔记】mysql添加用户、授权、修改密码

使用root登录,执行sql语句。

insert into mysql.user(Host,User,Password) values('localhost','用户名',password('密码'));  //添加用户
flush privileges;  //刷新数据库
create database 数据库名;  //新建数据库
grant all privileges on 数据库名.* to 用户名@localhost identified by '密码';  //给用户赋权
Delete FROM user Where User="用户名" and Host="localhost"; //删除用户

drop database 数据库名; //删除数据库

update mysql.user set password=password('新密码') where User="用户名" and Host="localhost";  //修改密码
posted @ 2013-10-12 15:08  test.cfs  阅读(153)  评论(0编辑  收藏  举报