So you’ve spent the past few hours creating your new website and are ready to upload your files from your localhost to your web server. You upload your site files and everything seems fine but how do you get that pesky MySQL database over to the new server? If you are running a Windows machine, then this guide will help. The following steps are assuming that you already have a MySQL database and know its name the username and password.
- Open the Windows Command Prompt.
- Type cd\program files\MySQL\MySQL Server 5.1\bin (keep in mind that you may be using a different version of MySQl and as such you should change the version number accordingly.
- Press Enter
- Type mysqldump -u -p db_name > db_name output file type (mysqldump -u root -p12345 db_name > db_name.txt)
- Keep in mind that db_name=your db’s name and db_name output file type = the name and file extension you wish to use. You can also choose to backup the database with the SQL extension.
- Press Enter
- Depending on the database’s size, this action could take a few seconds or a minute.
- Once completed, browse to C:\Program Files\MySQL\MySQL Server 5.1\bin and locate the file.
It’s really as simple as that. You can now upload this TXT or SQL file to your server using the PHP import function.