Skip to main content

Getting Connected

Overview#

To connect any database client application to PolyScale, update the database hostname and port to use one of the following based on the database type:

  • MySQL: mysql.polyscale.global on 3306
  • MariaDB: mariadb.polyscale.global on 3307
  • PostgreSQL postgres.polyscale.global on 5432

Additionally, the client must specify a PolyScale cache identifier. The method of how this is specified is database specific. See below for details on each database.

MySQL and MariaDB#

To connect to a MySQL or MariaDB database via PolyScale, a database username must be provided that contains the polyscale cache id. The cache id can be found under the Settings tab of each cache within the user interface.

Simply prepend the cache id to the origin database username, separated by a hyphen.

Example#

If the username provided by PolyScale is abc and the origin database username is foobar, the database username to connect via PolyScale would be abc-foobar.

PostgreSQL#

To connect to a PostgreSQL database via PolyScale, you must append a application_name parameter to the connection string that contains the PolyScale cache id. The cache id can be found under the Settings tab of each cache within the user interface.

Example#

Append the application_name key with the PolyScale cache id value to the connection string:

postgresql:///mydb?host=localhost&port=5433&application_name=[polyscale_cache_id]

Read more about PostgreSQL connection strings from the PostgreSQL documentation here and more about the application_name parameter here.

tip

If it is required to use the application_name property, simply prepend the PolyScale cache id to the desired application name separated by a hyphen and it will be passed to the PostgreSQL server as normal.

For example: application_name=POLYSCALE_CACHE_ID-my_app_name