-1

I have just come to realise that mysql on centos has a user account sa and I want to remove this account or set a password on it. There is no entry in the mysql.user table so a set password statement doesn't work.

Is it possible to set a password?

mysql -u sa

will get you to a mysql> prompt with limited access.

1 Answer 1

0

I think it is the anonymous user.

To get rid: try this (as mysql root):

DELETE FROM mysql.user WHERE User='';
FLUSH PRIVILEGES;

You may also want to get rid of test access:

DELETE FROM mysql.db WHERE db LIKE 'tes%' AND user='';
FLUSH PRIVILEGES;

Alternatively, these steps (and more) can be automatically taken care of by running the mysql_secure_installation script. https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html

2
  • Thank you, it was the anonymous user, DELETE FROM mysql.user WHERE User=''; FLUSH PRIVILEGES; did clear out the issue :) Apr 11, 2017 at 8:14
  • Glad it helped, please accept the answer if it has solved your problem :-)
    – bao7uo
    Apr 11, 2017 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .