Home > Database > Mysql Tutorial > mysql用户新建、授权、删除、密码修改_MySQL

mysql用户新建、授权、删除、密码修改_MySQL

WBOY
Release: 2016-06-01 13:29:38
Original
940 people have browsed it

bitsCN.com

mysql用户新建、授权、删除、密码修改

 

首先要声明一下:一般情况下,修改MySQL密码,授权,是需要有mysql里的root权限的。

 

注:本操作是在WIN命令提示符下,phpMyAdmin同样适用。

    用户:phplamp  用户数据库:phplampDB

 

1.新建用户。//登录MYSQL@>mysql -u root -p@>密码//创建用户mysql> insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));//刷新系统权限表mysql>flush privileges;这样就创建了一个名为:phplamp  密码为:1234  的用户。然后登录一下。mysql>exit;@>mysql -u phplamp -p@>输入密码mysql>登录成功2.为用户授权。如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码GRANTALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITHGRANT OPTION;FLUSH   PRIVILEGES;3.删除用户。@>mysql -u root -p@>密码mysql>DELETE FROM user WHERE User="phplamp" and Host="localhost";mysql>flush privileges;//删除用户的数据库mysql>drop database phplampDB;4.修改指定用户密码。@>mysql -u root -p@>密码mysql>update mysql.user set password=password('新密码') where User="phplamp" and Host="localhost";mysql>flush privileges;
Copy after login

 


bitsCN.com
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template