Try using mysqldump to create a backup of your original database
(mysqldump -u user -ppassword moodle > moodle-backup.sql). Move the new file 'moodle-backup.sql' to the new server then recreate the database using
'mysql -u user -ppassword moodle < /path/to/moodle-backup.sql'
this is a better practice than copying /var/lib/mysql/*.
Some points here: 1) it's better security not to type -ppassword. Just type -p and you will be prompted; 2) Have you set up mysql with appropriate users and privileges on the new server?
Backup and restore
How to backup and restore a full Moodle site!
This discussion has been locked so you can no longer reply to it.