Don't.
If you want to move Moodle from one server to another, follow the steps on Moodle migration.
If you want to upgrade from one version to the next, follow the instructions on Upgrading.
If you want to do both, then I recomment doing it is two separate steps, with a pause in-between to verify that the first step worked, before starting the second.