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

Set special characters for password when creating new MySQL user?

王林
王林forward
2023-09-10 14:37:061226browse

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

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

create user 'yourUserName'@'yourHostName' identified by 'yourSpecialCharacterPassword';

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)

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

mysql> select user,host from MySQL.user;

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)

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete