MySQL Delete anonymous user

Source: Internet
Author: User
Tags mysql delete

First Use the command to enter the database  

[Email protected] raul]# mysql-u root-penter password:welcome to the MySQL monitor.  Commands End With; or \g.your MySQL connection ID is 3Server version:5.1.73 Source distributioncopyright (c), +, Oracle and/or its a Ffiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.


Then switch the database into the database we need to operate MySQL

mysql> use mysqlreading table information for completion of table and column namesyou can turn off this feature to get A quicker startup With-adatabase changed

Before we delete, we'll look at the user table of the database to see if the user exists.

Mysql> Select User, host from user;+------+-----------------------+| user | Host                  |+------+-----------------------+| root | 127.0.0.1             | |      | localhost             | | root | localhost             | |      | Localhost.localdomain | | Root | Localhost.localdomain |+------+-----------------------+5 rows in Set (0.00 sec)

We see that the rows in the user column are empty. This is the anonymous user. In this step we have found anonymous users, the rest of the operation is to delete the user, to ensure that the login security

mysql> Delete from user where user= '; Query OK, 2 rows Affected (0.00 sec)

At this point, the status of the MySQL run shows that we have deleted two rows of data, and then run the query command, confirm that the deletion is really successful?

Mysql> Select User, host from user;+------+-----------------------+| user | Host                  |+------+-----------------------+| root | 127.0.0.1             | | root | localhost |             | root | Localhost.localdomain |+------+-----------------------+3 rows in Set (0.00 sec)

MySQL Delete anonymous user

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.