{% extends "base.html" %} {% import "_macros.html" as m with context %} {% block title %}Databases{% endblock %} {% block content %}
Each database gets a login with the same name. It signs in with a password or with a key.
| Name and login | {% if is_admin %}Account | {% endif %}Engine | Sign-in | Size | |
|---|---|---|---|---|---|
| {{ d.name }}{{ m.copy(d.name) }}{% if d.site %}in {{ d.site }}{% if d.auth == "password" %}, open in Adminer{% endif %}{% endif %} | {% if is_admin %}{{ d.owner }} | {% endif %}{{ d.engine_label }} | {% if d.auth == "key" %}{{ m.icon("key") }}Key{% else %}Password{% endif %} | {{ d.size|size }} | {% for kind in ("password", "key") %} {% endfor %} |
Use no password. Databases of a container website: host db or postgres, folder /var/www/private/db-keys/DATABASE. Databases on the server: host 127.0.0.1, as below.
$dir = '/home/ACCOUNT/db-keys/DATABASE';
// MariaDB
$db = new PDO('mysql:host=127.0.0.1;dbname=DATABASE', 'DATABASE', '', [
PDO::MYSQL_ATTR_SSL_KEY => "$dir/client.key",
PDO::MYSQL_ATTR_SSL_CERT => "$dir/client.crt",
PDO::MYSQL_ATTR_SSL_CA => "$dir/ca.crt",
]);
// PostgreSQL
$db = new PDO("pgsql:host=127.0.0.1;dbname=DATABASE;sslmode=verify-full;"
. "sslkey=$dir/client.key;sslcert=$dir/client.crt;sslrootcert=$dir/ca.crt", 'DATABASE');