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.
I would just do a mysqldump of the database(s) and then manually mirror the permissions for the database users. It'll be more direct and easier to do than trying to figure out a way to export (assuming it's feasible & reliable) user access and passwords.