亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

MySQL 8.0 用戶管理 更改密碼 創建用戶登錄 遇到很迷的問題

MySQL 8.0 用戶管理 更改密碼 創建用戶登錄 遇到很迷的問題

喵喵時光機 2019-05-10 15:59:34
1、MySQL版本8.0根據官方文檔來創建用戶,設置密碼。然后測試登錄以及更改密碼。1.1、創建用戶并登陸測試在MySQL服務器上創建用戶。mysql>createuser'aplan'@'%'identifiedby'Aplan123@';QueryOK,0rowsaffected(0.00sec)mysql>flushprivileges;QueryOK,0rowsaffected(0.00sec)mysql>grantallonaplan.*to'aplan'@'%';QueryOK,0rowsaffected(0.15sec)mysql>mysql>mysql>flushprivileges;QueryOK,0rowsaffected(0.00sec)然后使用用戶登錄MySQL測試[root@testzhiwei]#/usr/local/mysql/bin/mysql-uaplan-pAplan123@Warning:Usingapasswordonthecommandlineinterfacecanbeinsecure.ERROR1045(28000):Accessdeniedforuser'aplan'@'localhost'(usingpassword:YES)[root@testzhiwei]#[root@testzhiwei]#[root@testzhiwei]#[root@testzhiwei]#/usr/local/mysql/bin/mysql-uaplan-pEnterpassword:ERROR1045(28000):Accessdeniedforuser'aplan'@'localhost'(usingpassword:YES)無法登錄。1.2、更改用戶密碼mysql>ALTERUSER'aplan'@'%'IDENTIFIEDBY'password';ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear'IDENTIFIEDBY'password''atline1?????我這哪里的語法錯了???
查看完整描述

2 回答

?
慕沐林林

TA貢獻2016條經驗 獲得超9個贊

Thecaching_sha2_passwordandsha256_passwordauthenticationpluginsprovidemoresecurepasswordencryptionthanthemysql_native_passwordplugin,andcaching_sha2_passwordprovidesbetterperformancethansha256_password.Duetothesesuperiorsecurityandperformancecharacteristicsofcaching_sha2_password,itisasofMySQL8.0thepreferredauthenticationplugin,andisalsothedefaultauthenticationpluginratherthanmysql_native_password.
CREATEUSER'aplan'@'%'IDENTIFIEDWITHmysql_native_passwordBY'Aplan123@';
                            
查看完整回答
反對 回復 2019-05-10
?
慕仙森

TA貢獻1827條經驗 獲得超8個贊

注意文本格式,有時候在其他地方直接復制粘貼執行會有問題,例如從word復制執行。另外密碼如果有特殊符號,可以用單引號括起來。以下是測試,沒發現有什么問題:mysql>createuser'aplan'@'%'identifiedby'Aplan123@';QueryOK,0rowsaffected(0.02sec)
mysql>selectuser,hostfrommysql.user;
user
host
aplan
%
mysql.infoschema
localhost
mysql.session
localhost
mysql.sys
localhost
root
localhost
5rowsinset(0.00sec)
mysql>flushprivileges;QueryOK,0rowsaffected(0.04sec)
mysql>exitBye[root@linux-basemysql]#mysql-uaplan-p'Aplan123@'mysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure.WelcometotheMySQLmonitor.Commandsendwith;org.YourMySQLconnectionidis10Serverversion:8.0.12MySQLCommunityServer-GPL
Copyright(c)2000,2018,Oracleand/oritsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.
Type'help;'or'h'forhelp.Type'c'toclearthecurrentinputstatement.
mysql>selectuser();
user()
aplan@localhost
1rowinset(0.00sec)mysql>alteruseraplan@'%'identifiedby'password';QueryOK,0rowsaffected(0.04sec)
mysql>exitBye[root@linux-basemysql]#mysql-uaplan-p'password'mysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure.WelcometotheMySQLmonitor.Commandsendwith;org.YourMySQLconnectionidis11Serverversion:8.0.12MySQLCommunityServer-GPL
Copyright(c)2000,2018,Oracleand/oritsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.
Type'help;'or'h'forhelp.Type'c'toclearthecurrentinputstatement.
mysql>selectuser();
user()
aplan@localhost
1rowinset(0.00sec)
                            
查看完整回答
反對 回復 2019-05-10
  • 2 回答
  • 0 關注
  • 1306 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號