真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

MySQL之賬號(hào)管理

一 賬號(hào)管理

創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),龍馬潭企業(yè)網(wǎng)站建設(shè),龍馬潭品牌網(wǎng)站建設(shè),網(wǎng)站定制,龍馬潭網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,龍馬潭網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

1 創(chuàng)建賬號(hào):

示例 1:

建立賬號(hào)zwj,權(quán)限為在所有數(shù)據(jù)庫(kù)上具有所有權(quán)限

MySQL> grant all on *.* to 'zwj'@'192.168.154.180';

Query OK, 0 rows affected (0.01 sec)

為zwj設(shè)置密碼

mysql> grant all on *.* to 'zwj'@'192.168.154.180' identified by 'zwj';

Query OK, 0 rows affected (0.00 sec)

示例 2:

建立用戶user01,權(quán)限為test庫(kù)里所有表進(jìn)行select、update、insert、delete操作,密碼為"a123"。

mysql> grant select,update,insert,delete on test.* to 'user01'@'192.168.154.%' identified by 'a123';

Query OK, 0 rows affected (0.09 sec)

2 查看權(quán)限

查看指定賬戶的權(quán)限

mysql> show grants for 'user01'@'192.168.154.%';

+-------------------------------------------------------------------------------------------------------------------+

| Grants for user01@192.168.154.%                                                                                   |

+-------------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'user01'@'192.168.154.%' IDENTIFIED BY PASSWORD '*FF680E568727C9C00FABFEE03D13BA727047CC65' |

| GRANT SELECT, INSERT, UPDATE, DELETE ON `test`.* TO 'user01'@'192.168.154.%'                                      |

+-------------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)

查看當(dāng)前用戶權(quán)限

mysql> show grants;

+----------------------------------------------------------------------------------------------------------------------------------------+

| Grants for root@localhost                                                                                                              |

+----------------------------------------------------------------------------------------------------------------------------------------+

| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*DCB7DF5FFC82C441503300FFF165257BC551A598' WITH GRANT OPTION |

| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |

+----------------------------------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)

3 更改權(quán)限

新建用戶

mysql> grant select on test.* to 'bbs'@'192.168.154.%' identified by 'bbs';

Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'bbs'@'192.168.154.%';

+----------------------------------------------------------------------------------------------------------------+

| Grants for bbs@192.168.154.%                                                                                   |

+----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'bbs'@'192.168.154.%' IDENTIFIED BY PASSWORD '*74BAEAC2CAFC5C7162EF373C5C85EFBC7FC8B803' |

| GRANT SELECT ON `test`.* TO 'bbs'@'192.168.154.%'                                                              |

+----------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)

增加權(quán)限

mysql> grant select,insert,delete on test.* to 'bbs'@'192.168.154.%';

Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'bbs'@'192.168.154.%';

+----------------------------------------------------------------------------------------------------------------+

| Grants for bbs@192.168.154.%                                                                                   |

+----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'bbs'@'192.168.154.%' IDENTIFIED BY PASSWORD '*74BAEAC2CAFC5C7162EF373C5C85EFBC7FC8B803' |

| GRANT SELECT, INSERT, DELETE ON `test`.* TO 'bbs'@'192.168.154.%'                                              |

+----------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)

撤銷權(quán)限

mysql> revoke delete,insert on test.* from 'bbs'@'192.168.154.%';

Query OK, 0 rows affected (0.01 sec)

mysql> show grants for 'bbs'@'192.168.154.%';

+----------------------------------------------------------------------------------------------------------------+

| Grants for bbs@192.168.154.%                                                                                   |

+----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'bbs'@'192.168.154.%' IDENTIFIED BY PASSWORD '*74BAEAC2CAFC5C7162EF373C5C85EFBC7FC8B803' |

| GRANT SELECT ON `test`.* TO 'bbs'@'192.168.154.%'                                                              |

+----------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)

4 修改賬號(hào)密碼

方式 1:

mysql> set password for 'bbs'@'192.168.154.%' = password('abc-123');

Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

方式 2:

mysql> update mysql.user set password=password('aaa') where user='bbs' and host='192.168.154.%';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

方式 3:

[root@localhost tmp]# mysqladmin -u bbs -h 192.168.154.180 password "ccc" -p

Enter password: 

Warning: Using a password on the command line interface can be insecure.

為root初次設(shè)置密碼:

[root@www ~]# mysqladmin -uroot password "abc-123"

為root修改密碼:

[root@localhost tmp]# mysqladmin -uroot password 'root' -p

Enter password: 

Warning: Using a password on the command line interface can be insecure.

5 刪除賬戶

mysql> drop user 'bbs'@'192.168.154.%';

Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'bbs'@'192.168.154.%';

ERROR 1141 (42000): There is no such grant defined for user 'bbs' on host '192.168.154.%'


分享名稱:MySQL之賬號(hào)管理
本文URL:http://weahome.cn/article/gidgeo.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部