MySQL: Check if the user exists and drop it

前端 未结 14 1758
遇见更好的自我
遇见更好的自我 2020-12-02 16:43

There’s not standard way to check if a MySQL user exists and based on that drop it. Are there any workarounds for this?

Edit: I need a straight way to run this wi

14条回答
  •  孤城傲影
    2020-12-02 16:55

    in terminal do:

    sudo mysql -u root -p
    

    enter the password.

    select user from mysql.user;
    

    now delete the user 'the_username'

    DROP USER the_unername;
    

    replace 'the_username' with the user that you want to delete.

提交回复
热议问题