用戶管理
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比舒蘭網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式舒蘭網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋舒蘭地區(qū)。費(fèi)用合理售后完善,10年實(shí)體公司更值得信賴。
mysqluse mysql;
查看
mysql select host,user,password from user ;
創(chuàng)建
mysql create user zx_root IDENTIFIED by 'xxxxx'; //identified by 會(huì)將純文本密碼加密作為散列值存儲(chǔ)
修改
mysqlrename user feng to newuser;//mysql 5之后可以使用,之前需要使用update 更新user表
刪除
mysqldrop user newuser; //mysql5之前刪除用戶時(shí)必須先使用revoke 刪除用戶權(quán)限,然后刪除用戶,mysql5之后drop 命令可以刪除用戶的同時(shí)刪除用戶的相關(guān)權(quán)限
更改密碼
mysql set password for zx_root =password('xxxxxx');
mysql update mysql.user set password=password('xxxx') where user='otheruser'
查看用戶權(quán)限
mysql show grants for zx_root;
賦予權(quán)限
mysql grant select on dmc_db.* to zx_root;
回收權(quán)限
mysql revoke select on dmc_db.* from zx_root; //如果權(quán)限不存在會(huì)報(bào)錯(cuò)
mysql更改用戶權(quán)限
This entry was posted by admin Monday, 26 April, 2010
1.“grant all on *.* to root@’%’ identified by ‘yourpassword’;”——這個(gè)還可以順帶設(shè)置密碼。
2.“flush privileges; ”——刷新一下,讓權(quán)限生效。
mysql的一些其他的管理,可以用mysqladmin命令??梢杂脕碓O(shè)置密碼什么的。
grant方面的詳細(xì)信息可以看我下面的轉(zhuǎn)載:
本文實(shí)例,運(yùn)行于 MySQL 5.0 及以上版本。
MySQL 賦予用戶權(quán)限命令的簡單格式可概括為:
grant 權(quán)限 on 數(shù)據(jù)庫對(duì)象 to 用戶
一、grant 普通數(shù)據(jù)用戶,查詢、插入、更新、刪除 數(shù)據(jù)庫中所有表數(shù)據(jù)的權(quán)利。
grant select on testdb.* to common_user@’%’
grant insert on testdb.* to common_user@’%’
grant update on testdb.* to common_user@’%’
grant delete on testdb.* to common_user@’%’
或者,用一條 MySQL 命令來替代:
grant select, insert, update, delete on testdb.* to common_user@’%’
1,要授予的權(quán)限
2,被授予訪問權(quán)限的數(shù)據(jù)庫或表
3,用戶名
grant和revoke可以在幾個(gè)層次上控制訪問權(quán)限
1,整個(gè)服務(wù)器,使用 grant ALL 和revoke ALL
2,整個(gè)數(shù)據(jù)庫,使用on database.*
3,特點(diǎn)表,使用on database.table
4,特定的列
5,特定的存儲(chǔ)過程
看這個(gè)情況是多半是由于root@localhost root@'%' 兩個(gè)賬號(hào)的權(quán)限不同造成的 修改root@'%'的權(quán)限即可 或者新建一個(gè)外部賬號(hào)
在數(shù)據(jù)庫機(jī)上用root登陸:
給遠(yuǎn)程root賬號(hào)以所有數(shù)據(jù)庫的權(quán)限
grant all on *.* to root@'%' identified by 'password';
如果需要也可以加上 with grant option;
創(chuàng)建user賬號(hào)密碼password 可以從局域網(wǎng)內(nèi)訪問數(shù)據(jù)庫的所有庫
grant all on *.* to user@'192.168.1.%' identified by 'password';
網(wǎng)站標(biāo)題:mysql怎么修改權(quán)限,mysql權(quán)限設(shè)置
文章轉(zhuǎn)載:http://chinadenli.net/article0/hohcio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、企業(yè)網(wǎng)站制作、網(wǎng)站排名、小程序開發(fā)、網(wǎng)站導(dǎo)航、移動(dòng)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)