Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql rebuilds a user account (ERROR 1396 (HY00)

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Description: after the user molewan is deleted in MariaDB, the business needs to re-establish a user named molewan

1. Check the database and find that there are no molewan users anymore.

MariaDB [mysql] > select user,host from mysql.user;+-+-+ | user | host | +-+-+ | molewan1 | 10.10.10.% | | admin | localhost | +-+-+ 2 rows in set (0.00 sec)

2. Create a new molewan user and report an error

MariaDB [mysql] > create user molewan@'10.10.10.%' identified by 'molewan';ERROR 1396 (HY000): when Operation CREATE USER failed for' molewan'@'10.10.10.%' remembered to delete a molewan user, it was MariaDB [mysql] > delete from mysql.user where user= "molewan1" and host = "10.10.10.%" deleted by the delete command; MariaDB [mysql] > flush privileges

3. Check the information and find that if you want to completely not apply to a certain user, it is recommended to use the drop command.

MariaDB [mysql] > drop user molewan@'10.10.10.%';Query OK, 0 rows affected (0.00 sec) MariaDB [mysql] > flush privileges;Query OK, 0 rows affected (0.00 sec)

Additional note: DROP USER will not automatically terminate the connected user session, that is, if the deleted user has connected to the server before deletion and the connection has not been interrupted, it can continue to perform certain operations at this time, but its identity has changed to household registration.

4. Users who rebuild molewan

MariaDB [mysql] > create user molewan@'10.10.10.%' identified by 'molewan';Query OK, 0 rows affected (0.01sec) MariaDB [mysql] > select user,host from mysql.user +-+-+ | user | host | +-+-+ | molewan | 10.10.10.% | | admin | localhost | +-+-+ 2 rows in set (0.00 sec)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report