The safest way to back up a MySQL database is to use mysqldump which dumps the database in a text-file containing SQL statements:
mysqldump -c -u root -p DATABASE >DATABASE-backup.sql
(on one line)
Then, on the fresh MySQL, you restore the database by
1. Creating the database in the MySQL shell:
create database DATABASE
2. Jump out of the MySQL shell, and:
3. Run:
mysql -u root -p DATABASE <DATABASE-backup.sql
(on one line)