You really do not want to move just the MySQL database file from one server to another. MySQL really doesn't like that, and it's a complicated process to get right even for people who use databases all day long.
What you are looking for is a database export, which you can create from the command line like this:
sudo mysqldump {database} > {filename}
So, if your WordPress database is called wordpress
, and you want the file to be called export.sql
, then you would do something like this:
sudo mysqldump wordpress > export.sql
So long as you are using the stock version of MySQL that is available for Ubuntu, and so long as you've not made a mess of the permissions structure by tampering with root
, there is no need to enter a username or password while doing this. Anyone who has sudo
permissions on a server is considered an administrator.
After copying the export file to the new server, you can import it like so:
sudo mysql {database} < {filename}
Note that this is using mysql
rather than mysqldump
, and also note that there is a <
instead of a >
. These are important. As before you will want to replace {database}
and {filename}
with the appropriate values.
Be sure that the database you're importing the data into exists before trying to import the data.
However ...
Based on the way the question is written, and based on many years of experience with WordPress-powered sites, it would be better for you to not migrate the database.
WordPress has a lot of domain-specific and filesystem-specific settings stored in its database that can often result in a rather large headache for people who would like to migrate data from one place to another. While all of this can be fixed with additional SQL queries, it's really not something that most people want to do.
A simpler solution would be to simply install WordPress on the live web server and configure everything from scratch. If you have a bunch of posts that you would like to bring over, then doing a copy/paste between the two admin pages would be the simpler way to go, especially if you have embedded content such as images, audio, video, and the like.