mysql使用者授權

2021-09-01 10:07:41 字數 1269 閱讀 3370

mysql 使用者授權

預設情況下 mysql 是以root 使用者進入 並且操作的,那麼要想以其他使用者進入並且對資料庫進行增刪改查的工作那麼就需要 以root 使用者的身份進入 給資料庫授權 給 相應的使用者

server0:/usr/local/mysql/bin # mysql -uroot -p

enter password:

mysql> show databases;

+--------------------+

| database           |

+--------------------+

| information_schema |

| mysql              |

| solrclient         |

| test               |

+--------------------+

mysql> grant all privileges on solrclient.* to suse@localhost identified by 'suse『;

query ok, 0 rows affected (0.00 sec)

mysql> flush privileges;

query ok, 0 rows affected (0.00 sec)

mysql>\q

還可以進行更細粒度的 授權:

//如果想指定部分許可權給一使用者,可以這樣來寫:

mysql>grant select,update on solrdb.* to suse@localhost   identified by 『suse』;

3.刪除使用者

@>mysql -u root -p

@>密碼

mysql>delete from user where user='suse'and host=」localhost」;

mysql>flush privileges;

//刪除使用者的資料庫

mysql>drop database  solrdb;

4.修改指定使用者密碼

@>mysql -u root -p

@>密碼

mysql>update mysql.user set password=password(『新密碼』) where user='suse' and host=」localhost」;

mysql>flush privileges;

mysql>quit;

作者「715356603-qq-com」

mysql 授權 mysql 使用者授權

mysql grant 許可權1,許可權2,許可權n on 資料庫名稱.表名稱 to 使用者名稱 使用者位址 identified by 連線口令 許可權1,許可權2,許可權n代表select,insert,update,delete,create,drop,index,alter,grant,re...

mysql授權使用者許可權 mysql授權使用者許可權

grant 普通資料使用者,查詢 插入 更新 刪除 資料庫中所有表資料的權利。grant select on testdb.to common user grant insert on testdb.to common user grant update on testdb.to common us...

mysql授權 MySQL使用者授權(GRANT)

當成功建立使用者賬戶後,還不能執行任何操作,需要為該使用者分配適當的訪問許可權。可以使用 show grant for 語句來查詢使用者的許可權。注意 新建立的使用者只有登入 mysql 伺服器的許可權,沒有任何其他許可權,不能進行其他操作。usage on 表示該使用者對任何資料庫和任何表都沒有許...