mysql使用者和許可權 MySQL使用者和許可權管理

2021-10-18 23:44:22 字數 2474 閱讀 5398

使用者名稱@主機

使用者名稱:16字元以內

主機:主機名:www.chen.com, mysql

ip: 192.168.0.99

192.168.0.0/255.255.255.0

萬用字元:%,_

192.168.0.%

%.chen.com

--skip-name-resolve   略過名稱解析

許可權級別:

全域性級別: super、

庫表: delete, alter, trigger

列: select, insert, update

儲存過程和儲存函式

臨時表:記憶體表

heap: 16mb

觸發器:主動資料庫

insert, delete, update

user: log建立使用者:

create user username@host [identified by 『password『]grant all privileges on [object_type] priv_level to username@『%『 [with with_option ...];

object_type:

table | function | procedure

priv_level:

* | *.* | db_name.* | db_name.tbl_name | tbl_name | db_name.routine_name

with_option:

grant option                      可以將自己的許可權授予給別人

| max_queries_per_hour count        每小時最多允許發起多少次查詢請求

| max_updates_per_hour count        每小時最多允許發起多少次更新請求

| max_connections_per_hour count    每小時最多允許發起多少次連線請求

| max_user_connections count      每個使用者最多允許同時連線幾次grant execute on function db.abc to username@『%『;insert into mysql.user

mysql> flush privileges;檢視使用者的授權資訊:

show grants for 『username@host『;刪除使用者:

drop user 『username『@『host『重新命名使用者:

rename user old_name to new_name**許可權:

revoke

priv_type [(column_list)]

[, priv_type [(column_list)]] ...

on [object_type] priv_level

from user [, user] ...

revoke select on chendb.* from chen@『%『;

啟動mysqld_safe時傳遞兩個引數:

--skip-grant-tables     跳過授權表

--skip-networking       跳過從網路登入

通過更新 授權表方式直接修改其密碼,而後移除此兩個選項重啟伺服器。

mysql使用者都是儲存在mysql.user中的(user表中有user,host,password等列)通過修改mysql.user可以實現使用者控制修改root密碼

#mysqladmin -u root -hhost -p password 『new password『建立使用者

登入:  #mysql -u root -p

建立使用者: #create user 『your username『@『localhost『 identified by 『your password『;授權:

grant privileges on databasename.tablename to 『username『@『host『  identified by 『password『;

例:#grant all on *.* to 『your username』@『%『;     *.*表示任意databasename.tablename

為使用者設定密碼:

1.mysql>set password for 『username『@『host『 = password(『newpassword『);

flush privileges; 重讀授權表

例:mysql>set password for 『your username『@『%『=password("newpassword");

2.mysql>update user set password=password(『newpassword『) where user=『username『 and host=『host『;

mysql使用者和許可權管理

標籤:contents   database   accounts   server   memory

mysql使用者和許可權 MySQL使用者及許可權知識梳理

一 賬號使用者賬號mysql使用者賬號組成 user host user 使用者名稱。mysql create user user host identified by pwd 使用者重新命名 mysql rename user old username to new username 刪除使用者 ...

MySQL使用者和許可權

一 相關命令彙總 use mysql update user set user test where user grant all on to jerry identified by mypass flush privieleges select user show grants二 實際問題彙總 3...

mysql配置使用者許可權 mysql使用者許可權配置

mysql使用者許可權配置 有什麼不對的地方請各位大神多多指教!1,檢視使用者表 mysql select user,password,host from mysql.user user 使用者名稱 password 密碼 加密 host 連線ip 2,開放遠端連線 vim etc mysql ma...