-2

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)
Mike Moore
  • 223
  • 2
  • 7
  • 15

1 Answers1

2

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.

Alex
  • 7,789
  • 4
  • 36
  • 51
  • 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 02: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 02:25