Assuming you are using mysql (mediawiki works w/ pgsql too I think):
Be warned, mysqldump will lock your tables so they don't change while reading them. If you have converted them to InnoDB (not the default, but highly recommended) then you can add
--single-transaction below, and they won't be write-locked:
mysqldump --user root --password root_pass your_database > file.sql
copy file.sql to new server
mysqladmin create your_database
mysql --user root --password root_pass -e "GRANT ALL PRIVILEGES ON your_database.* TO user_name@localhost IDENTIFIED BY 'pass'"
mysql --user user_name --password pass < file.sql
Don't forget to copy your uploaded files directory as well (use scp or rsync), good luck!