Home > Database > Mysql Tutorial > Set special characters for password when creating new MySQL user?

Set special characters for password when creating new MySQL user?

王林
Release: 2023-09-10 14:37:06
forward
1263 people have browsed it

创建新的 MySQL 用户时为密码设置特殊字符?

To set special characters for password, use the following syntax -

create user 'yourUserName'@'yourHostName' identified by 'yourSpecialCharacterPassword';
Copy after login

Let us implement the above syntax to create a new user and set the password using special characters -

mysql> create user 'Mike'@'localhost' identified by 'Mike_123456';
Query OK, 0 rows affected (0.35 sec)
Copy after login

Let us check the table that stores MySQL users and hosts -

mysql> select user,host from MySQL.user;
Copy after login

This will produce the following output. New user created successfully -

+------------------+-----------+
| 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)
Copy after login

The above is the detailed content of Set special characters for password when creating new MySQL user?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template