Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 963 Bytes

log-in-db.md

File metadata and controls

41 lines (33 loc) · 963 Bytes

The following steps provide an example of accessing a database:

  1. SSH to the integration environment.

    magento-cloud ssh
  2. Find the database login information:

    php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"]))->database);'

    Sample output follows:

    Array
     (
          [0] => stdClass Object
            (
               [username] => user
               [password] =>
               [ip] => 192.0.2.60
               [host] => database.internal
               [query] => stdClass Object
                  (
                    [is_master] => 1
                  )
               [path] => main
               [scheme] => mysql
               [port] => 3306
            )
        )
  3. Use the following command to connect to the database:

    mysql --host=<host> --user='<database username>' --password='<user password>' --port='<port>' --database='<path>'