您好,登錄后才能下訂單哦!
1.登錄mysql
#mysql -u root -p
2.新增用戶
insert into mysql.user(Host,User,Password) values("localhost","xxx",password("***"));
注釋:xxx為新建用戶名,***為用戶密碼
3.執行該句后,還需要刷新權限表
flush privileges;
4.新建數據庫并賦予用戶權限
create database dbtest;
全部授權:
允許本地登錄
grant all privileges on dbtest.* to xxx@localhost identified by "*";
允許任何主機登錄
grant all privileges on dbtest. to xxx@'%' identified by "";
部分授權:
grant select,update on dbtest.* to xxx@localhost identified by "***";
5.賦予權限,還需要再刷新權限表
flush privileges;
6.通過sql語句查詢出新增結果
select user,host,password from mysql.user;
7.刪除用戶
delete from user where user=‘xxx’;
flush privileges;
8.刪除數據庫
drop database dbtest;
9.修改密碼
update mysql.user set password=password(‘新密碼’) where User='xxx' and Host='localhost';
flush privileges;
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。