Mobile app version of vmapp.org
Login or Join
Berumen354

: How do I replace a MySQL Database? I created a database on the host server using PHPMyAdmin. I exported the database for local development and have since added data and changed the schema

@Berumen354

Posted in: #Cpanel #Mysql #Phpmyadmin

I created a database on the host server using PHPMyAdmin.

I exported the database for local development and have since added data and changed the schema slightly.

How can I replace the database on the server with my local version? Some source I read say to go to that database in PHPMyAdmin and upload, but I'm not convinced that is correct.

How do I replace a MySQL Database?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Berumen354

3 Comments

Sorted by latest first Latest Oldest Best

 

@Fox8124981

There is an alternative way to export and import the database if you have terminal access to the server.

Export the file via terminal
Execute the following command replacing the MySQL username, database name, and the filename you wish to create.

mysqldump -u <username> -p <dbname> > <filename>.sql


Import the file using terminal
After uploading the file to your server, you can browse to the location and execute the following command replacing the MySQL username, database name, and the filename you already have.

mysql -u <username> -p <dbname> < <filename>.sql

10% popularity Vote Up Vote Down


 

@Shelley277

Yes you can. You just export your database as sql file and import it via phpmyadmin.

Export:



Import:

Note that if you have a very large sql file your host might not let you upload it via this wizard.

10% popularity Vote Up Vote Down


 

@Shelley277

On your local machine you need to backup the database in .sql format. Once you do, access phpMyadmin from your cPanel. Click on the database and import the .sql file.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme