要設定密碼的特殊字符,請使用以下語法-
create user 'yourUserName'@'yourHostName' identified by 'yourSpecialCharacterPassword';
讓我們實作上述語法來建立一個新使用者並使用特殊字元設定密碼-
mysql> create user 'Mike'@'localhost' identified by 'Mike_123456'; Query OK, 0 rows affected (0.35 sec)
讓我們檢查儲存MySQL 使用者和主機的表-
mysql> select user,host from MySQL.user;
這將產生以下輸出。新使用者建立成功 -
+------------------+-----------+ | user | host | +------------------+-----------+ | Bob | % | | Charlie | % | | Robert | % | | User2 | % | | mysql.infoschema | % | | mysql.session | % | | mysql.sys | % | | root | % | | @UserName@ | localhost | | Adam Smith | localhost | | Chris | localhost | | David | localhost | | James | localhost | | John | localhost | | John Doe | localhost | | Mike | localhost | | User1 | localhost | | am | localhost | | hbstudent | localhost | | mysql.infoschema | localhost | | mysql.session | localhost | +------------------+-----------+ 21 rows in set (0.00 sec)
以上是建立新的 MySQL 使用者時為密碼設定特殊字元?的詳細內容。更多資訊請關注PHP中文網其他相關文章!