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
- Create new session
- Network type MariaDb or MySQL
- Host name 127.0.0.1
- Port: 30000
- User: your_user_name
- Password: *****
Refs