magento · ssh · database

How to connect to Magento Cloud Database using SSH

Published

1 min read

If you need access to the Magento Cloud Database to explore tables, run some SQL queries, etc., you can do so by opening an ssh tunnel using the magento-cloud utility so the step-by-step guide is below.

In this example I will use HeidiSQL - is free software, and has the aim to be easy to learn. "Heidi" lets you see and edit data and structures from computers running one of the database systems MariaDB, MySQL, Microsoft SQL, PostgreSQL and SQLite.

In the Magento folder, run the command

magento-cloud tunnel:single

Select needed database/application

Enter a number to choose a relationship:
  [0] database (database_stg)
  [1] database-slave (database_stg)
  [2] elasticsearch
  [3] redis
  [4] redis-slave

In this example, let it be 0 - the main database

SSH tunnel opened to database at: mysql://user:[email protected]:30000/database_stg?compression=1

Run HeidiSQL to establish a connection to the database

  1. Create new session
  2. Network type MariaDb or MySQL
  3. Host name 127.0.0.1
  4. Port: 30000
  5. User: your_user_name
  6. Password: ***** heidisql-connect-to-magento-cloud-db11-48-54.png

Refs

  1. Secure connections to remote environments
  2. HeidiSQL

Are we a good fit? Let's discuss.

Tell us about your store and what you want to get done. If we're a fit, you get a clear next step. If not, we'll tell you.

  • Reply within one business day
  • Fixed estimate before we start
  • No commitment