用戶工作空間分為join_buffer_size,sort空間,binlog_cache_size,每一個(gè)都能變量都可以動(dòng)態(tài)修改大小
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了清苑免費(fèi)建站歡迎大家使用!
set @@global.join_buffer_size=name;即可
1、創(chuàng)建新用戶
通過root用戶登錄之后創(chuàng)建
grant all privileges on *.* to testuser@localhost identified by "123456" ;//創(chuàng)建新用戶,用戶名為testuser,密碼為123456 ;
grant all privileges on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,可以在本地訪問mysql
grant all privileges on *.* to testuser@"%" identified by "123456" ; //設(shè)置用戶testuser,可以在遠(yuǎn)程訪問mysql
flush privileges ;//mysql 新設(shè)置用戶或更改密碼后需用flush privileges刷新MySQL的系統(tǒng)權(quán)限相關(guān)表,否則會(huì)出現(xiàn)拒絕訪問,還有一種方法,就是重新啟動(dòng)mysql服務(wù)器,來使新設(shè)置生效
2、設(shè)置用戶訪問數(shù)據(jù)庫(kù)權(quán)限
grant all privileges on test_db.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只能訪問數(shù)據(jù)庫(kù)test_db,其他數(shù)據(jù)庫(kù)均不能訪問 ;
grant all privileges on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,可以訪問mysql上的所有數(shù)據(jù)庫(kù) ;
grant all privileges on test_db.user_infor to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只能訪問數(shù)據(jù)庫(kù)test_db的表user_infor,數(shù)據(jù)庫(kù)中的其他表均不能訪問 ;
3、設(shè)置用戶操作權(quán)限
grant all privileges on *.* to testuser@localhost identified by "123456" WITH GRANT OPTION ;//設(shè)置用戶testuser,擁有所有的操作權(quán)限,也就是管理員 ;
grant select on *.* to testuser@localhost identified by "123456" WITH GRANT OPTION ;//設(shè)置用戶testuser,只擁有【查詢】操作權(quán)限 ;
grant select,insert on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只擁有【查詢\插入】操作權(quán)限 ;
grant select,insert,update,delete on *.* to testuser@localhost identified by "123456" ;//設(shè)置用戶testuser,只擁有【查詢\插入】操作權(quán)限 ;
REVOKE select,insert ON what FROM testuser//取消用戶testuser的【查詢\插入】操作權(quán)限 ;
mysql 創(chuàng)建一個(gè)用戶 hail,密碼 hail,指定一個(gè)數(shù)據(jù)庫(kù) haildb 給 hail
mysql -u root -p
password
use mysql;
insert into user(host,user,password) values('localhost','hail',password('hail'));
flush privileges;
create database haildb;
grant all privileges on haildb.* to hail@localhost identified by 'hail';
flush privileges;
如果想指定部分權(quán)限給用戶
grant select,update on haildb.* to hail@localhost identified by 'hail';
flush privileges;
刪除用戶
delete from user where user='hail' and host='localhost';
flush privileges;
刪除用戶數(shù)據(jù)庫(kù)
drop database haildb;
修改指定用戶密碼
update user set password=password('new_password') where user='hail' and host='localhost';
flush privileges;
root登錄服務(wù)器,運(yùn)行命令,注意username和data修改
grant create view on username.* to data@'%';
grant show view on username.* to data@'%';