Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently corrupted the mysql.user table in my mysql install on centos 5.6, so I removed the mysql and mysql-server packages and then removed /var/lib/mysql. Then, I re-installed mysql and mysql-server via yum. Here is the output of SELECT user.User FROM mysql.user;

mysql> SELECT User FROM user;
+------+
| User |
+------+
| root |
|      |
| root |
|      |
| root |
+------+
5 rows in set (0.00 sec)

Does anybody know if there is a data file other than /var/lib/mysql laying around somewhere? Or just how to solve this?

Here is the result of SELECT Host, User FROM user;

mysql> SELECT Host, User FROM user;
+---------------+------+
| Host          | User |
+---------------+------+
| 127.0.0.1     | root |
| server-name   |
| server-name   | root |
| localhost     |      |
| localhost     | root |
+---------------+------+
5 rows in set (0.00 sec)
share|improve this question
    
How did you corrupt the mysql.user table? –  Rilindo Aug 27 '11 at 2:14
    
I added and deleted rows from mysql.user and mysql.db –  Mike Moore Aug 27 '11 at 2:23
    
I had thought I corrupted the users table. It turns out I did not understand how the users table works. I don't agree with the negative vote. –  Mike Moore Aug 27 '11 at 4:15

1 Answer 1

up vote 2 down vote accepted

Why do you think it is corrupt? Try the following query: select Host,User from user; and you will see non-empty host columns on every row. BTW your query gives me 6 rows on a fresh Percona Server install.

share|improve this answer
    
I thought that there should only be one root user listed. I am brand-spanking new to user management in mysql, so I was definitely making an assumption. I added the output of select Host, User from user to my answer. –  Mike Moore Aug 27 '11 at 2:21
2  
No, many root users are perfectly valid, they are for different hosts, see different hostnames in your query. Of course, all these hostnames are just your server names, this is normal. MySQL uses 'user'@'host' pairs to distinguish users. –  Alex Aug 27 '11 at 2:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.