MySQL: Check if the user exists and drop it

前端 未结 14 1757
遇见更好的自我
遇见更好的自我 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:48

    If you mean you want to delete a drop from a table if it exists, you can use the DELETE command, for example:

     DELETE FROM users WHERE user_login = 'foobar'
    

    If no rows match, it's not an error.

提交回复
热议问题