手机看片精品高清国产日韩,色先锋资源综合网,国产哺乳奶水91在线播放,乱伦小说亚洲色图欧洲电影

幫助中心 >  技術(shù)知識庫 >  數(shù)據(jù)庫 >  數(shù)據(jù)庫管理 >  mysql新建用戶并分配管理指定的數(shù)據(jù)庫

mysql新建用戶并分配管理指定的數(shù)據(jù)庫

2015-11-10 20:09:54 10771

1.首先創(chuàng)建用戶密碼:tom  tompassword

    >mysql -uroot -p 鍵入密碼登陸到root用戶

    mysql>insert into mysql.user(host,user,password) values(‘localhost’,’tom’,password(‘tompassword’));  #表中插入用戶

    mysql>flush ppribileges;       #刷新系統(tǒng)權(quán)限表

2.創(chuàng)建數(shù)據(jù)庫:dbtom

    mysql>create database dbtom;

3.授權(quán)tom用戶擁有dbtom數(shù)據(jù)庫的所有權(quán)限

    mysql>grant all privileges on tomdb.* to tom@localhost identified by ‘tom’; 

    mysql>flush privileges;

如果僅僅指定部分權(quán)限給tom用戶:

    mysql>grant select,update on dbtom.* to tom@localhost identified by ‘tom’;   

    mysql>flush privileges;

4.這樣tom用戶就可以登陸到mysql中對dbtom數(shù)據(jù)庫進(jìn)行管理了,但是對其他數(shù)據(jù)庫沒有操作權(quán)限。

5.刪除用戶

    mysql>delete from user where user=”tom” and host=”localhost”;

    mysql>flush privileges;

6.刪除數(shù)據(jù)庫

    mysql>drop database tomdb;

7.修改tom用戶的密碼

    mysql>update mysql.user set password=password(‘新密碼’) where user=”tom”;

    mysql>flush privileges;

    mysql>quit;

提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: