創(chuàng)建用戶,庫及權(quán)限的分配

--建數(shù)據(jù)庫 
create database zxlh default character set utf8;

--建用戶,只訪問zxlh數(shù)據(jù)庫,%表示不限制任何ip
grant all PRIVILEGES on zxlh.* to 'zxlh'@'%' identified by 'zxlh';

--建用戶,訪問所有數(shù)據(jù)庫
grant all PRIVILEGES on *.* to 'root'@'%' identified by '123456' WITH GRANT OPTION;

--刷新
flush privileges;

更細(xì)致的權(quán)限分配可以通過工具比如 navicte 

用戶信息可以在MySQL.user中看到
use mysql
select host,user,passsword from user;


忘記密碼:
service mysql55-mysqld stop
 
mysqld_safe --user=root --skip-grant-tables

mysql -u root
 
use mysql
 
update user set password=password("new_pass") where user="root";
 
flush privileges;  

文章題目:創(chuàng)建用戶,庫及權(quán)限的分配
轉(zhuǎn)載注明:http://muchs.cn/article36/ihjppg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)域名注冊、企業(yè)網(wǎng)站制作網(wǎng)站改版、App開發(fā)、企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營