MySQL: Dumping a MySQL database

This documentation is part of the Advanced usage guide. View the full guide here: How to configure, optimize, export, or import MySQL data.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use MySQL cloud solution that provides a host of benefits, including:

  • Unlimited connections and transfers.
  • phpMyAdmin web UI included.
  • Effortless updates with just a click.
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's MySQL cloud hosting solution!

To create a database backup (or "dump"), you can use the mysqldump tool directly from your computer. (See the previous section for details on running it inside Docker if you prefer.)

To export a database from your Stackhero instance to your computer, you can run:

mysqldump -u root -p -h <XXXXXX>.stackhero-network.com -P <PORT> <DATABASE> > <DATABASE>.sql

Make sure to replace <XXXXXX>.stackhero-network.com, <PORT>, and <DATABASE> with your actual instance details. After you run the command, you will be prompted for the root password. The mysqldump tool will then save your database tables in a file named <DATABASE>.sql.

To import a database from your computer into your Stackhero instance, you can use this command:

mysql -u root -p -h <XXXXXX>.stackhero-network.com -P <PORT> <DATABASE> < yourDump.sql

Just remember to replace yourDump.sql with the actual filename for the SQL file you want to import.