3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
MySql 新增使用者與設定權限 每次要在 MySQL 新稱使用者總是用一次查一次,我來記錄一下好了。要新增使用者與賦予權限的方式如下: 先使用 root 進入 MySQL mysql -uroot -p 接下來我們新增一個使用者 killme, 密碼設定為 killpwd, 並且給予資料庫的所有權限 1 2 3 4 5 6 7 use mysql;   INSERT INTO user(host,user,password) VALUES('%','killme',password('killpwd'));   GRANT ALL ON *.* TO 'killme'@localhost IDENTIFIED BY 'killpwd' WITH GRANT OPTION;   FLUSH PRIVILEGES; 如果要給予使用者特定資料庫的操作權限可以這麼做: 1 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE ON dbname.* TO 'killme'@localhost IDENTIFIED BY 'killpwd'; 執行過程如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [root@server htdocs]# mysql -uroot -p Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 53481 Server version: 5.0.45 Source distribution   Type 'help;' or '\h' for help. Type '\c' to clear the buffer.   mysql> use mysql; 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> insert into user (host,user,password) values('%','killme',password('killpwd')); Query OK, 1 row affected, 3 warnings (0.00 sec)   mysql> GRANT ALL ON *.* TO 'killme'@localhost IDENTIFIED BY 'killpwd' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)   mysql> mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)   mysql> 分享到 Twitter(在新視窗中開啟) 按一下以分享至 Facebook(在新視窗中開啟) 分享到 LinkedIn(在新視窗中開啟) 點這裡寄給朋友(在新視窗中開啟) 按一下即可分享至 Skype(在新視窗中開啟) 分享到 Reddit(在新視窗中開啟) 分享到 Tumblr(在新視窗中開啟) 按一下以分享到 Telegram(在新視窗中開啟)

本文由toright提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦