Connect a Database
Add a database
You can use Plato to connect and manage any MySQL or PostgreSQL database listening on a public IP address. If your database is running inside a private network with no public internet access, please contact us and we can help deploy Plato inside your network.
To ensure Plato can connect to your database, navigate to your cloud admin console or server configuration and whitelist Plato’s IP address:
34.82.67.27
.In the lefthand nav bar, click the “Add New” button.
Click “Add Database”.
Select your database engine. Plato currently supports MySQL and PostgreSQL.
Enter the name of your database. This must match the name of your database on your server.
Enter the host and port on which your database is listening.
Enter the username and password of the user that Plato will use to connect to your database.
You can enter the credentials of an existing user, but we strongly recommend provisioning a dedicated user, often named
plato
. Many Plato users choose to provision a user with write access so they can update their database inside of Plato, but if needed you may choose to provision a read-only user.(Optional) To encrypt the connection between Plato and your database, toggle “Connect with SSL”. Your database must be configured to support SSL.
(Optional) If your database is configured to authenticate clients with an SSL keypair, toggle “Connect with an SSL keypair” and paste your the public certificate and private key for the user you specified above.
Click “Add Database”. If there are connection errors, they will be displayed at the bottom of the form. If the connection is successful, you will see your database and all its tables added to the lefthand nav bar.
Note: Tables without primary keys will not be displayed in Plato, because many features require rows to have a unique identity. Primary keys also happen to be a best practice in relational database design, so we strongly recommend defining one for each table.
Provision a read-only user
While you can reuse an existing database user for Plato, we strongly recommend provisioning a dedicated user. Many Plato users choose to provision a read-write user so they can update their database in Plato, but if you know you’ll only use Plato for queries, you may want to provision a read-only user.
PostgreSQL
To provision a read-only user named plato
in a PostgreSQL database named production
, issue the following commands:
Log in to the PostgreSQL server with a superuser account.
Create a new user named
plato
:CREATE USER plato WITH PASSWORD 'password';
Replace
‘password’
with a strong password for the user.Grant read-only access to the "production" database to the "Plato" user:
GRANT CONNECT ON DATABASE production TO plato;
GRANT USAGE ON SCHEMA public TO plato;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO plato;
MySQL
To provision a read-only user named plato
in a MySQL database named production
, issue the following commands:
Log in to the MySQL server with a superuser account.
Create a new user named
plato
:CREATE USER 'plato'@'34.82.67.27' IDENTIFIED BY 'password';
Replace
'password'
with a strong password for the user.Grant read-only access to the "production" database to the "plato" user:
GRANT SELECT ON production.* TO 'plato'@'34.82.67.27';