mysql數(shù)據(jù)庫添加用戶及分配權(quán)限具體實(shí)現(xiàn)
更新時(shí)間:2014年02月08日 15:34:43 作者:
這篇文章主要介紹了mysql數(shù)據(jù)庫添加用戶及分配權(quán)限的方法,需要的朋友可以參考下
創(chuàng)建用戶并分配權(quán)限;
insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));//創(chuàng)建用戶
grant all privileges on dbname.* to 'username'@'%' identified by 'password';//創(chuàng)建用戶并分配所有權(quán)限
grant select,update on phplampDB.* to phplamp@localhost identified by '1234';//創(chuàng)建用戶并分配權(quán)限
update mysql.user set password=password('新密碼') where User="phplamp" and Host="localhost";//修改用戶密碼
--刪除用戶指定權(quán)限
revoke insert,update,delete,select ON *.* from 'xbb'@'localhost' IDENTIFIED BY '123';
復(fù)制代碼 代碼如下:
insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));//創(chuàng)建用戶
grant all privileges on dbname.* to 'username'@'%' identified by 'password';//創(chuàng)建用戶并分配所有權(quán)限
grant select,update on phplampDB.* to phplamp@localhost identified by '1234';//創(chuàng)建用戶并分配權(quán)限
update mysql.user set password=password('新密碼') where User="phplamp" and Host="localhost";//修改用戶密碼
--刪除用戶指定權(quán)限
revoke insert,update,delete,select ON *.* from 'xbb'@'localhost' IDENTIFIED BY '123';
相關(guān)文章
MySQL InnoDB 鎖的相關(guān)總結(jié)
這篇文章主要介紹了MySQL InnoDB 鎖的相關(guān)知識(shí)總結(jié),幫助大家更好的理解和使用MySQL,感興趣的朋友可以了解下2021-02-02
MySQL count(*/column)查詢優(yōu)化的實(shí)現(xiàn)
count()是SQL中一個(gè)常用的聚合函數(shù),其被用來統(tǒng)計(jì)記錄的總數(shù),本文主要介紹了MySQL count(*/column)查詢優(yōu)化的實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下2024-09-09
MySQL 數(shù)據(jù)庫常用命令 簡單超級(jí)實(shí)用版
MySQL 數(shù)據(jù)庫常用命令,都是一些比較基礎(chǔ)的東西,更多的命令可以查看相關(guān)文章里面的文字。2010-07-07
MySQL數(shù)據(jù)庫基礎(chǔ)篇之入門基礎(chǔ)命令小結(jié)
這篇文章主要介紹了MySQL數(shù)據(jù)庫入門基礎(chǔ)命令,總結(jié)分析了mysql數(shù)據(jù)庫基本創(chuàng)建、刪除、查看、權(quán)限等相關(guān)操作技巧與注意事項(xiàng),需要的朋友可以參考下2020-05-05
關(guān)于MySQL自增ID的一些小問題總結(jié)
這篇文章主要給大家總結(jié)介紹了關(guān)于MySQL自增ID的一些小問題,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用MySQL具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11

