新聞中心
RENAME USER 語(yǔ)句修改一個(gè)或多個(gè)已經(jīng)存在的用戶(hù)賬號(hào)。

創(chuàng)新互聯(lián)是專(zhuān)業(yè)的延安網(wǎng)站建設(shè)公司,延安接單;提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專(zhuān)業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行延安網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專(zhuān)業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專(zhuān)業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
語(yǔ)法格式如下:
RENAME USER <舊用戶(hù)> TO <新用戶(hù)>
其中:
- <舊用戶(hù)>:系統(tǒng)中已經(jīng)存在的 MySQL 用戶(hù)賬號(hào)。
- <新用戶(hù)>:新的 MySQL 用戶(hù)賬號(hào)。
使用 RENAME USER 語(yǔ)句時(shí)應(yīng)注意以下幾點(diǎn):
- RENAME USER 語(yǔ)句用于對(duì)原有的 MySQL 用戶(hù)進(jìn)行重命名。
- 若系統(tǒng)中舊賬戶(hù)不存在或者新賬戶(hù)已存在,該語(yǔ)句執(zhí)行時(shí)會(huì)出現(xiàn)錯(cuò)誤。
- 使用 RENAME USER 語(yǔ)句,必須擁有 mysql 數(shù)據(jù)庫(kù)的 UPDATE 權(quán)限或全局 CREATE USER 權(quán)限。
例 1
使用 RENAME USER 語(yǔ)句將用戶(hù)名 test1 修改為 testUser1,主機(jī)是 localhost。SQL 語(yǔ)句和執(zhí)行過(guò)程如下。
mysql> RENAME USER 'test1'@'localhost'
-> TO 'testUser1'@'localhost';
Query OK, 0 rows affected (0.03 sec)
在 cmd 命令行工具中,使用 testUser1 用戶(hù)登錄數(shù)據(jù)庫(kù)服務(wù)器,如下所示。
C:\Users\USER>mysql -h localhost -u testUser1 -p Enter password: ***** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.7.20-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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.
本文標(biāo)題:MySQL修改用戶(hù)(RENAMEUSER)
URL分享:http://www.dlmjj.cn/article/dpedgeh.html


咨詢(xún)
建站咨詢(xún)
