mysql新建库和用户linux_Linux环境 Mysql新建用户和数据库并授权
Linux環境 Mysql新建用戶和數據庫并授權
發布時間:2020-04-28 21:03:50
來源:51CTO
閱讀:1878
作者:dnuser
#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;
總結
以上是生活随笔為你收集整理的mysql新建库和用户linux_Linux环境 Mysql新建用户和数据库并授权的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 毕节到贞丰县有大巴车吗?
- 下一篇: activiti mysql数据库表_M