mysql5.X 增加新用戶

1、以管理員身份登錄mysql

mysql -u root -p

2、選擇mysql數據庫

use mysql

3、創建用戶並設定密碼

create user ‘testuser’@’localhost’ identified by ‘testpassword’

4、使操作生效

flush privileges

5、爲用戶創建數據庫

create database testdb

6、爲用戶賦予操作數據庫testdb的所有權限

grant all privileges on testdb.* to test@localhost identified by ‘1234’

7、使操作生效

flush privileges

8、用新用戶登錄

mysql -u test -p

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章