Question: When migrating a MySQL database from Server(A) to Server(B) which tables should be dumped and migrated to Server(B), including user grants? I don't want to have to manually re-enter user accounts and passwords. I wish to do this using a third part application like **Navicat**, without using mysqldump. My understanding is following tables contain user account (grant) data:

**mysql > db**  

**mysql > user** 

However, I've read that the **mysql** table does not need to be migrated from Server(A) to Server(B) as well as the **information\_scheme** table. But, if the mysql table does not need to be migrated, unless that comment is incorrect, how do I migrate my user grant info with hosts, usernames, passwords, etc.

Answer: 
```
#!/bin/bash
# adapted from (http://www.pyrosoft.co.uk/blog/2006/10/18/show-grants-for-all-users-on-mysql/)
 ( mysql -pPASSWORD --batch --skip-column-names -e "SELECT user, host FROM user" mysql 
 ) | while read user host
    do
        echo "# $user @ $host"
        mysql -pPASSWORD --batch --skip-column-names -e"SHOW GRANTS FOR '$user'@'$host'"
    done

```

This script will "dump" all of the users permissions and their hashed passwords. I've had mixed results from importing dumps of the mysql and information\_schema databases.
You need to migrate databases, not just tables. The information you have received is somewhat incorrect as the mysql database is the one you do need to migrate. That's the one that contains all your security information and will eliminate the need to manually reconstruct that data. However, the information\_schema is a virtual database, which is created each time MySQL is started, so it's pointless bothering with that.

I suggest you use mysqldump rather than Navicat, which is unreliable and can produce some really strange and incomplete results at times, whereas mysqldump is designed specifically for the job.