MySQL笔记-mysql权限授权及创建用户
生活随笔
收集整理的這篇文章主要介紹了
MySQL笔记-mysql权限授权及创建用户
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
MySQL創建用戶的方式:
1. insert into user;
2. create user;
3. grant all privileges on *.* to 'xxx'@'xxx' ?identified by 'xxxxx'
?
?
演示如下:
查看user表目前存在的用戶:
select user, host,passowrd from mysql.user;增加新用戶有如下幾種方式
insert into mysql.user(user, host, password) values('xxx', 'xxx', password('xxx')); flush privileges;一般user mysql,這個mysql庫是放到內存中的,這個flush privileges就會更新相愛內存。如果使用下面這個命令,就不需要flush privileges了!
create user ''@'' identified by '123456'%這個是指可以從任意IP進行登錄。
下面是查看權限:
show grants for 'xxxx'@'xxx';下面是授予權限的命令,grant命令既可以授予權限,又可以創建用戶
grant all privileges on *.* to 'xxxx'@'xxxx'如果創建用戶后,又授予權限:
grant all privileges on *.* to 'it1996'@'%' identified by 'it1996';如下只授予查詢權限:
grant select on xx數據庫.* 'xxx'@'xxx';刪除用戶,這里用戶被刪除后
drop user 用戶名總結
以上是生活随笔為你收集整理的MySQL笔记-mysql权限授权及创建用户的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 信息安全工程师笔记-网络安全测评技术与标
- 下一篇: Spring Cloud笔记-eurek