Search

11.9.4. Accessing a Database Cartridge

download PDF
The integrity of a database is verified by connecting to an application using SSH and running the shell for the database cartridge. A successful connection to the database shell indicates that the database has been created correctly.
The shell for each database also offers a selection of management commands. See the appropriate database documentation for more information on the available database shell commands.

Important

Although accessing applications with the shell environment provides advanced operations, accidental damage to your application can occur. Therefore, Red Hat recommends to use shell access only when necessary.

Procedure 11.3. To Manage a Database in a Shell Environment:

  1. Access the desired application in a shell environment with the following command:
    $ rhc ssh App_Name
  2. From the application's shell environment prompt, run the appropriate command for the database to access the interactive database shell:
    • Run the mysql command to access the MySQL shell.
    • Run the psql command to access the PostgreSQL shell.
    • Run the mongo command to access the MongoDB shell.

    Example 11.12. Accessing a MySQL Shell

    [racer-automobile.example.com 515e21acdbd93c051d000022]\> mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.1.71 Source distribution
    
    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>

Note

Since OpenShift Enterprise does not allow editing MySQL server configuration, it may be necessary to specify certain settings in the client connection string. For example, the default character set is Latin-1. If you would like to use UTF-8 instead, set the character set and collation as parameters on the connection string. For example, in a Java EE application, the URL would be specified in persistence.xml like:
<connection-url>jdbc:mysql://xxx.x.xxx.xxx:xxxx/databaseName?useUnicode=yes&amp;characterEncoding=UTF-8</connection-url>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.