Jim
Jim

Reputation: 14270

How do you drop the WordPress database user?

I've created a LAMP server and installed WordPress 5.5 on it. The MySQL database username for my WordPress database is called 'wp_user'. I've granted my own administrative user account all privileges on all databases. I'm now experimenting with various settings and would like to manually drop the WordPress user temporarily and then recreate it but I get an error when I try:

mysql> DROP USER wp_user;

ERROR 1396 (HY000): Operation DROP USER failed for 'wp_user'@'%'

Why can't I drop this user? Are there some processes I have to kill first?

Upvotes: 0

Views: 932

Answers (2)

Optimizer
Optimizer

Reputation: 727

flush privileges; To tell the server to reload the grant tables.

DROP USER 'wp_user'@'localhost';

Again flush privileges;

SELECT user, host FROM mysql.user where user = 'wp_user';

The query will return empty set.

Upvotes: 0

Valdeir Psr
Valdeir Psr

Reputation: 702

Verify that the user actually exists: SELECT user, host FROM mysql.user where user = 'YOUR_USER';.

If it really exists: flush privileges; and then DROP USER 'YOUR_USER'@'localhost';

Still did not work?

Try this:

DELETE FROM mysql.user WHERE user='YOUR_USER' AND host = 'localhost';

flush privileges;

Upvotes: 1

Related Questions