Whatbox Logo
Login for certain variables to be updated with your slot's information

Wiki > MySQL / MariaDB

Initial install

Run the following to set up the initial database:

/usr/bin/mariadb-install-db --user=$USER --auth-root-authentication-method=socket --datadir=/home/$USER/.config/mysql/data --basedir=/usr --skip-networking --socket=/home/$USER/.config/mysql/mysqld.sock --log-error=/home/$USER/.config/mysql/mysqld.err --pid-file=/home/$USER/.config/mysql/mariadb.pid

This will create two database users: root, and user. Processes running under the account user will be able to connect to MariaDB without requiring a password. Other users on the Whatbox server will not be able to connect to your database because it will only be listening on a socket, at /home/$USER/.config/mysql/mysqld.sock, rather than a TCP port.

Starting MySQL / MariaDB

Run the following to start mysqld:

/usr/bin/mysqld_safe --skip-networking --socket=/home/$USER/.config/mysql/mysqld.sock --datadir=/home/$USER/.config/mysql/data --pid-file=/home/$USER/.config/mysql/mariadb.pid --log-error=/home/$USER/.config/mysql/mysqld.err --nowatch

TODO: Add directions for adding to cron to restart on server reboots

If you need to connect to mysql, run the following:

mysql --socket=/home/$USER/.config/mysql/mysqld.sock