Delete a user in MySQL if exists

Below is the query to delete the user account in MySQL by checking if exists before:

DROP USER IF EXISTS 'YourUser'@'localhost';

Replace YourUser with the username of the user which you want to delete in the above query.