mysql資料庫修改使用者許可權

2021-10-02 22:39:10 字數 958 閱讀 9020

1、登陸:mysql -u root -p

2、檢視現有使用者:select host ,user ,authentication_string from mysql.user;

3、新建使用者:create user 'username'@'host' identified by 'password'

eg: create user "testuser"@'host' identified by "123456"

4、刪除使用者:drop user "username"@"localhost"

5、修改使用者許可權

grant  許可權 on 資料庫名.表名 to 'username'@"localhost";

eg: grant select on testdatase.* to 'user1'@'localhost';  //給user1使用者新增對testdatabse資料庫的查許可權。

flush privileges  //重新整理許可權

6、檢視許可權

show grant for 'username'@'%'

7、刪除許可權

revoke select on testdatase.* to 'user1'@'localhost';

8、更改使用者名稱:rename user 'user1'@'localhost' to 'user2'@'localhost'

9、修改密碼:set password for "username"@'localhost' = password('123456')

10、pymysql 連線資料庫報錯:connect database failed, (1045, "access denied for user 'user1'@'192.168.31.124' (using passwor

只要重新去改一下user1的密碼:set password for "user1"@'localhost' = password('123456')

MySQL修改使用者許可權

關於mysql的使用者管理,筆記 1 建立新使用者 通過root使用者登入之後建立 grant all privileges on to testuser localhost identified by 123456 建立新使用者,使用者名為testuser,密碼為123456 grant all ...

ubuntu下 Mysql修改使用者許可權

show databases use mysql 使用者資料都在mysql資料庫的user表中grant許可權名稱on資料庫to賬戶 主機identified by 密碼 with grant option flush privileges 重新整理許可權,修改完後必須要有這一步 例 grant a...

ubuntu 修改使用者許可權

登入使用者 zyj 修改普通使用者具有root許可權 sudo su vim etc sudoers 新增一行 修改資料夾所屬 將這兩個資料夾改為屬於zyj使用者 許可權說明 d rwx rwx r x d 表示為目錄 資料夾 其它檔案系統物件 常規檔案 d 目錄 l 符號鏈結 c 字元特殊裝置 b...