How do I copy a wordpress database?

The same WordPress Codex has a page for backing up your database with phpmyadmin; see http://codex.wordpress.org/Backing_Up_Your_Database

You must export and import the database itself – and not do a posts export from the dashboard – to retain all settings, image URLs, etc.

Either use phpmyadmin in your host control panel, or you can use it as a plugin called Portable phpmyadmin: http://wordpress.org/extend/plugins/portable-phpmyadmin/

But if you use the plugin, you may have to try an older version, as the newer alpha version doesn’t work on some web hosts due to host restrictions.

And, if you are changing domains as well as hosts, you need to correctly change URLs in the database. interconnectit.com WordPress Serialized PHP Search Replace Tool