You can use the remote shell host to interact with your application databases. Please note that MySQL does not run locally but on dedicated infrastructure. From the shell host, you can log in, dump database content into a file and restore a database from a dump file. You can find the user credentials and database hostname in the configuration snippets freistilbox provides for each individual application (directory
In the following examples, we use placeholders for the username, hostname and database name. Note that we use always the parameter
-p without an argument for security reasons. That way, you will be prompted for the password interactively instead of the password getting exposed publicly in the system process list.
mysql -u <username> -p -h <hostname> DB-ID
mysqldump -u <username> -p -h <hostname> DB-ID --single-transaction > file.sql
mysql -u <username> -p -h <hostname> DB-ID < file.sql
You can also use drush to dump and copy the database, you don’t need to look out for the credentials then as drush does this automatically for you.
The following commands are to be run from the sites users home directory.
This will dump the database to the current directory. If you leave the $(pwd) out, the command will fail because drush uses current/docroot as current directory and you don’t have write permission there.
drush -r current/docroot sql-dump --result-file=$(pwd)/file.sql
gunzip < file.sql.gz | drush -r current/docroot sql-cli
or, if the file is not zipped:
cat file.sql | drush -r current/docroot sql-cli
There is currently no automated mechanism to do this but you can simply dump the contents of the source database and restore them to the target database, as explained above.
If you’d like to access your database from your web browser, freistilbox offers a PhpMyAdmin user interface on pma.freistilbox.net.
In order to access your database from an application running on your workstation, you’ll have to set up an SSH tunnel to the database via your freistilbox cluster’s remote shell host:
ssh -L 3307:db12.freistilbox.net:3306 \ email@example.com
3307is the local port,
db12.freistilbox.netis the hostname of the database cluster,
3306is the default MySQL listening port,
s1234is your website user account, and
c42s.freistilbox.netis the hostname of the remote shell host.
With the encrypted tunnel established in this way, you’ll be able to reach your database securely on
localhost, port 3307.
With advanced database management applications such as Sequel Pro and MySQL Workbench, you don’t have to set up the tunnel manually. Since they have this functionality built in already, simply provide them with the required details.