中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySql增加用戶、授權、修改密碼等語句

發布時間:2020-08-12 16:07:24 來源:ITPUB博客 閱讀:183 作者:huangdazhu 欄目:MySQL數據庫
MySql增加用戶、授權、修改密碼等語句


數據庫top_develop
登錄數據庫
1:新增用戶
[mysql@lcamdb ~]$ mysql -u root -p
Enter password: *****
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql>use mysql


mysql> insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values("localhost","top_hdz",password("top_hdz"),'','','');
Query OK, 1 row affected (0.00 sec)


mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)


mysql> SELECT host, user, password FROM user WHERE user = "top_hdz";
+-----------+---------+-------------------------------------------+
| host      | user    | password                                  |
+-----------+---------+-------------------------------------------+
| localhost | top_hdz | *9E2182EFC0FDC01E6EDC9FE113C4158587B31889 |
+-----------+---------+-------------------------------------------+
1 row in set (0.00 sec)


進行登錄測試
[mysql@lcamdb mysql]$ mysql -u top_hdz -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.6.17 Source distribution


Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> use top_develop
ERROR 1044 (42000): Access denied for user 'top_hdz'@'localhost' to database 'top_develop'




2:進行授權,訪問top_develop 數據庫所有對象的權限
grant all privileges on top_develop.* to top_hdz@localhost identified by 'top_hdz';
Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges; 
Query OK, 0 rows affected (0.00 sec)


權限添加之后:
mysql> use top_develop
ERROR 1044 (42000): Access denied for user 'top_hdz'@'localhost' to database 'top_develop'
mysql> use top_develop
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A


Database changed
mysql> exit
Bye
如果想指定部分權限給一用戶,可以這樣來寫: 
mysql>grant select,update on top_develop.* 


3.刪除用戶。 
@>mysql -u root -p 
@>密碼 
mysql>Delete FROM user Where User="top_hdz" and Host="localhost"; 
mysql>flush privileges; 
//刪除用戶的數據庫 
mysql>drop database top_develop; 
4.修改指定用戶密碼。 
@>mysql -u root -p 
@>密碼 
mysql>update mysql.user set password=password('新密碼') where User="top_hdz" and Host="localhost"; 
mysql>flush privileges; 
5.列出所有數據庫 
mysql>show database; 
6.切換數據庫 
mysql>use '數據庫名'; 
7.列出所有表 
mysql>show tables; 
8.顯示數據表結構 
mysql>describe 表名; 
9.刪除數據庫和數據表 
mysql>drop database 數據庫名; 
mysql>drop table 數據表名;

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

松原市| 太仆寺旗| 波密县| 温州市| 运城市| 虹口区| 永新县| 平舆县| 香格里拉县| 苏尼特右旗| 岢岚县| 宜川县| 延川县| 高淳县| 雅安市| 大丰市| 安岳县| 清徐县| 南宁市| 仲巴县| 突泉县| 江西省| 宜君县| 沙湾县| 娄烦县| 穆棱市| 广饶县| 全州县| 团风县| 建瓯市| 鹿邑县| 岳西县| 宿松县| 陈巴尔虎旗| 高青县| 稷山县| 体育| 皋兰县| 翁牛特旗| 迭部县| 沙洋县|