MySQL removes the difference between users using the drop and delete methods

Source: Internet
Author: User

In learning the drop method to delete the user, according to the book has not been operational success, and then to the online search for some other information, only to understand the method of the drop, posted out and share with you.


(method i) Drop User user name;

Syntax: Drop User user name;

role: Delete the user that already exists, for example to delete Yan, (dropUseryan;) The default deletion is [email protected] "%" This user, if there are other users, such as [email protected] "localhost", [email protected] "IP", will not be deleted together. If there is only one user [email protected] "localhost", use the statement (dropUserYan;) will error, should use (dropUser[email protected] " localhost ";) if you cannot determine the name of the machine (user name @ machine name), you can find it in the user table in MySQL, which corresponds to the username, and the host column corresponds to the machine name.

from  user  where  and  host= "localhost";

delete is also a way to delete a user, for example to remove [ Email protected] "localhost" user, you can (delete  FROM&NBSP, user &NBSP, where   user= "Yan" &NBSP, and  host= "localhost" ;)


Note: Drop deleted users not only delete data from the user table, but also delete content such as DB and other permission tables. and (method two) just delete the contents of the user table, the other tables will not be deleted, later if the name of a deleted user and the same names, permissions will be inherited.


This article from "Dongdong Homeland" blog, declined reprint!

MySQL removes the difference between users using the drop and delete methods

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.