How to update the database of a CMS on Fortrabbit using a local DB
Prepare the database, open the tunnel in Terminal and in a separate Terminal, run the mysql command, through the example of a CraftCMS hosted on Fortrabbit.
Step One: Setup the DB
To avoid the error message: ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation, we recommend that you import the DB into a DDEV instance of CraftCMS and download it through the Craft CMS Utilities.
Step Two: Open up a Tunnel
Navigate to the link below to learn how to open up a tunnel to Fortrabbit in Terminal.
Please note that the Examples dropdown on the top right can be updated to give you the exact line for opening a tunnel for your app.
Step Three: Import the DB
The image above demonstrates where to find the password for the MySQL command.
Open a separate terminal and run the line below, replacing LOCAL_PATH_TO_YOUR_DB.sql with the path to the database.
mysql -h127.0.0.1 -P13306 -ucraft3-xs7n -p craft3-xs7n < LOCAL_PATH_TO_YOUR_DB.sql
You will be prompted to put in a password, input the MySQL password found in your app on the Fortrabbit website.
Looking to learn more about CraftCMS?
Search our blog to learn more about CraftCMS, design and technology.