Use your database
In the examples, svm123 is your username and SERVER_IP is your server address — both are on the Access tab of your SVM in the console.
Every SVM comes with a MariaDB database account. Its details and password are on the Database tab of your SVM in the console (on an older SVM, press Create database there first):
host
localhost
the database runs on the same server; apps connect locally (127.0.0.1:3306 for TCP)
user
svm123
same name as your SSH user, with its own password
db
svm123_db
created for you
You can create more databases yourself, as long as their names start with your username and an underscore:
# in your SSH session no password is needed
mysql
CREATE DATABASE svm123_shop; # must start with svm123_
# import and export
mysql svm123_db < dump.sql
mysqldump svm123_db > ~/backup.sqlConnect your apps with the password from the Database tab. Keep it in an environment variable or a config file outside ~/www/public:
// PHP (PDO) — "localhost" uses the local socket
$db = new PDO('mysql:host=localhost;dbname=svm123_db;charset=utf8mb4', 'svm123', getenv('DB_PASSWORD'));
// Node.js (mysql2)
const db = await mysql.createConnection({
socketPath: '/run/mysqld/mysqld.sock', // or host: '127.0.0.1', port: 3306
user: 'svm123', password: process.env.DB_PASSWORD, database: 'svm123_db'
});To work with the data in the browser, open phpMyAdmin from the link on the Database tab and log in with the same username and password.
- Databases count towards a separate allowance the size of your plan's disk. Above it, the databases become read-only (reading and deleting still work); writing comes back within a few minutes of freeing space or upgrading.
- Resetting the password on the Database tab takes effect immediately — update your apps' configuration right after.
- The database only accepts connections from the server itself. To use a desktop client, open an SSH tunnel: ssh -L 3306:127.0.0.1:3306 svm123@SERVER_IP, then connect to 127.0.0.1:3306.