mysql數(shù)據(jù)庫添加用戶及分配權(quán)限具體實(shí)現(xiàn)
更新時間: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查詢優(yōu)化之IN子查詢優(yōu)化方法詳解
項(xiàng)目中有需要,使用MySQL的in子查詢,查詢符合in子查詢集合中條件的數(shù)據(jù),但是沒想到的是,MySQL的in子查詢會如此的慢,讓人無法接受,下面這篇文章主要給大家介紹了關(guān)于Mysql查詢優(yōu)化之IN子查詢優(yōu)化的相關(guān)資料,需要的朋友可以參考下2023-02-02Mysql TIMESTAMPDIFF函數(shù)示例詳解
這篇文章主要介紹了Mysql TIMESTAMPDIFF函數(shù)示例詳解,TIMESTAMPDIFF函數(shù)返回datetime_expr2 - datetime_expr1的結(jié)果,其中datetime_expr1和datetime_expr2可以是DATE或DATETIME類型值,本文給大家詳細(xì)講解,需要的朋友可以參考下2023-03-03兩種方法實(shí)現(xiàn)mysql分組計數(shù),范圍匯總
這篇文章主要介紹了兩種方法實(shí)現(xiàn)mysql分組計數(shù),范圍匯總,文中示例代碼非常詳細(xì),幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下2020-07-07innodb_flush_method取值方法(實(shí)例講解)
下面小編就為大家?guī)硪黄猧nnodb_flush_method取值方法(實(shí)例講解)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-03-03