Opalstack's shared MariaDB instance is optimized for multi-tenant shared hosting, and individual customers aren't able to adjust the DB server configuration. If you do need that kind of control, or just want to learn more about running your own database server instance, then the following procedure is for you!
Here's how to install and run your own private instance of MariaDB on Opalstack:
- Create a new shell user. The rest of this procedure will use - myuseras the shell user name - be sure to replace that with your own shell user name. You can use an existing shell user if you want to.
 
- Create a new "proxy port" application for the new shell user. Make a note of the app name and port assignment. The rest of this procedure will use - mariaas the name and- 55555as the port - be sure to replace them with your own app name and port.
 
- SSH to your server as the shell user you created in step 1. 
- Run the following commands as your shell user to populate the app directory: - cd ~/apps/maria
mkdir -p {etc,var,tmp}
 
- Create - ~/apps/maria/etc/my.cnfwith the following contents, replacing the shell user name, app name, and port with your own:
 - [client]
port = 55555
socket = /home/myuser/apps/maria/var/mysql.sock
[mysqld]
port = 55555
socket = /home/myuser/apps/maria/var/mysql.sock
tmpdir = /home/myuser/apps/maria/tmp
datadir = /home/myuser/apps/maria/data
[mysqld_safe]
log-error = /home/myuser/logs/apps/maria/maria.log
pid-file = /home/myuser/apps/maria/var/pid
 
- Run the following commands as your shell user to initialize and start the instance. You'll see a couple of errors in the output of - mysql_install_dbbut you can ignore them:
 - cd ~/apps/maria
mysql_install_db --defaults-file=$HOME/apps/maria/etc/my.cnf --datadir=$PWD/data --tmpdir=$PWD/tmp --user=$USER 
mysqld_safe --defaults-file=$HOME/apps/maria/etc/my.cnf --socket=$HOME/apps/maria/var/mysql.sock --nowatch
 
- Run the following commands as your shell user to log into the private instance and create your first DB and DB user. Be sure to replace - name_of_db,- name_of_db_user, and- some_password_herewith your own values.
 - mysql -P 55555 -S $HOME/apps/maria/var/mysql.sock
# then, in the console:
create database name_of_db;
create user 'name_of_db_user'@'localhost' identified by 'some_password_here';
grant usage on *.* to 'name_of_db_user'@'localhost' identified by 'some_password_here';
grant all on name_of_db.* to 'name_of_db_user'@'localhost';
# now press CTRL-D to exit 
 
- If you have an application that you want to connect to your new database on your private instance then configure it with the following values: - DB server or hostname: localhostor127.0.0.1
- DB port: your assigned port from step 2, eg 55555as shown above.
- DB socket: /home/myuser/apps/maria/var/mysql.sock
- DB name: the name of your database from step 7, eg name_of_db
- DB user: the name of your database user from step 7, eg name_of_db_user
- DB password: the password you specified for your database user in step 7, eg some_password_here
 
At this point you're up and running on your new private MariaDB instance. You can control the instance with the following commands:
- Start: mysqld_safe --defaults-file=$HOME/apps/maria/etc/my.cnf --socket=$HOME/apps/maria/var/mysql.sock --nowatch
- Stop: mysqladmin -P 55555 -S $HOME/apps/maria/var/mysql.sock shutdown
If you need to run other MariaDB/MySQL administrative commands you can do so, just be sure to include the port and socket options. Here's an example for mysqladmin status:
[myuser@opalN ~]$ mysqladmin -P 55555 -S $HOME/apps/maria/var/mysql.sock status
Uptime: 1370  Threads: 7  Questions: 6  Slow queries: 0  Opens: 17  Flush tables: 1  Open tables: 11  Queries per second avg: 0.004
That's it! If you need a private MariaDB instance then please give this a try and let me know how it goes here in the comments. :-)