how to copy all mysql users manually?


Well-Known Member
Aug 27, 2001
If a drive is too full and I can't run backups, I want to copy the entire /var/lib/mysql directory but that doesn't copy db users and permissions.

Where is the db user data located?


Well-Known Member
Feb 25, 2010
Houston, TX
cPanel Access Level
Root Administrator
Make a dump of the MySQL database

As yapluka mentioned, these data are in the mysql database. The best way to preserve these data is to make a dump of the mysql database, which will create a file that contains all of the commands needed to create the database again. A very basic use of the mysqldump command would be the following:

# mysqldump mysql > /root/mysql.sql
This will create a dump file in /root, mysql.sql, that contains all of the SQL statements needed to create the mysql database again. To import the database in the future, simply redirect the dump file into MySQL:

# mysql mysql < /root/mysql.sql
If you need to move the MySQL data directory due to lack of disk space, there are several threads in our forums that describe how to do this. A couple of good suggestions are the following:
cPanel Forums - View Single Post - Move MySQL Databases