MySQL授權查詢 MySQL授權以及狀態查詢

2021-10-22 08:03:50 字數 2005 閱讀 6792

mysql授權以及狀態查詢 create database odi; -- 建立odi資料庫grant all privileges on *.* to odi@

mysql授權以及狀態查詢

create database odi; -- 建立odi資料庫

grant all privileges on *.* to odi@'%' identified by 'odipasswd'; -- 遠端授權;

flush privileges; -- 重新整理授權表

delete from user where user="odi"; -- 刪除該使用者授權

create database allen;

grant all privileges on test.* to odi@'%' identified by 'odipasswd'; -- 遠端授權

grant all privileges on test to odi@'%' identified by 'odipasswd'; -- 遠端授權

grant all privileges on phplampdb.* to phplamp@localhost identified by '1234';

-- grant 許可權 on 資料庫名.表名 使用者@登入主機 identified by "使用者密碼";

-- grant 許可權 on 資料庫名.表名 使用者@登入主機 identified by "使用者密碼";

-- select host,user,password from user;

-- update user set host = 』%』 where user = 』fang』;

create database ccc;

grant all privileges on ccc.* to ccc@'%' identified by 'cccpasswd'; -- 遠端授權;

flush privileges; -- 重新整理授權表

-- 新建使用者

insert into mysql.user(host,user,password) values("%","testdb",password("testpasswd"));

-- 建立新資料庫

create database testdb;

-- 授權test使用者擁有testdb資料庫的所有許可權(某個資料庫的所有許可權)

grant all privileges on testdb.* to test@localhost identified by 'testpasswd';

-- 授權test使用者擁有所有資料庫的某些許可權

grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";

-- 刪除使用者

delete from user where user='test' and host='localhost';

flush privileges;

drop database testdb; //刪除使用者的資料庫

-- 刪除賬戶及許可權:

drop user 使用者名稱@'%';

drop user 使用者名稱@ localhost;

-- 修改某乙個使用者的密碼

update mysql.user set password=password('新密碼') where user="test" and host="localhost";

flush privileges;

-- 列出所有資料庫

show databases;

-- 切換資料庫

use database_name;

-- 列出所有表

show tables;

-- 顯示表結構

describe tables_name;

-- 刪除資料庫

drop database database_name;

-- 刪除資料表

drop table tables_name;

mysql 網路授權工具 mysql給主機授權

grant語句雖然能夠為使用者分配許可權,使用比較方便,但是從安全角度,從增加對系統了解角度,你應該盡量使用直接修改授權表的方法。這樣可以更精確的控制授權,能夠對授權表完全了解,避免因為 grant語句的錯誤,是mysql伺服器的安全性降低。首先進入mysql的命令列 允許位址192.168.0.5...

mysql查詢授權狀態 MySQL授權以及狀態查詢

mysql授權以及狀態查詢 create database odi 建立odi資料庫grant all privileges on to odi mysql授權以及狀態查詢 create database odi 建立odi資料庫 grant all privileges on to odi ide...

mysql授權 mysql授權

2.授權法。pis1 允許使用者myuser使用mypassword從任何主機連線到mysql伺服器。sql 1 grant all privileges on to myuser identified by mypassword with grant option 2 flush privileg...