Using MySQL

From ULYSSIS documentation

MySQL is one of the most popular databases for websites. It's used by most CMSes and other common web software, and many programming languages have support for it. ULYSSIS specifically uses MariaDB, which is a fork of MySQL with similar features and (almost) identical SQL syntax, but offers better performance and has less corporate interference in the development process.

Managing MySQL

All common management tasks can be performed through our control panel UCC, under the MySQL section.

Creating a MySQL user

To use MySQL on your ULYSSIS account, you first need to create a MySQL user on UCC. In the MySQL section of the panel, you will be suggested to click a link to create a user. Then fill in a password for the database user. It is highly recommended that this password differs from the password you use for your account. Finally, click Create user and you are ready to go.

Creating a MySQL database

After having created a MySQL user, you can click Add database in UCC and enter the name for your new database. It will automatically be prefixed by your username.

Deleting a MySQL database

If you no longer need a database, you can easily remove it by clicking on MySQL in UCC and then pressing on Remove database next to the database you would like to delete. After confirming, the database and all its tables and other contents will be gone. For security reasons, you can't remove databases using an SQL query like DROP DATABASE, but have to go through UCC.

Accessing MySQL

Our MySQL and PostgreSQL databases run on a separate database server, this means you may need to enter a specific host, together with the correct credentials, to access your database within a website or application. You may also wish to use a common tool such as PHPMyAdmin or access a database remotely. Details on how to do that are available in the sections below.

Using MySQL for your website or application

you can connect to the database with the following details:

Username: your account's username
Password: the password you chose when you made the MySQL user
Database: the database name you chose, prefixed by your username

For example, if my username is foobar, I made a database called website and I were to create a PHP website I would use something like:

$db = new mysqli('', 'foobar', 'correct horse battery staple', 'foobar_website');


$db = new PDO(';dbname=foobar_website', 'foobar', 'correct horse battery staple');

Accessing MySQL with PHPMyAdmin or Adminer

Using your username and password you can easily manage your MySQL databases, tables and records on and Documentation is also available to aid in using PHPMyAdmin and using Adminer.

Accessing MySQL from outside of our network

To prevent unnecessary load on our database server by hackers and bots it is only available inside of our network. If you wish to access it externally the easiest way is to use an SSH tunnel. In many MySQL management tools this is already supported.

On Linux, Mac OSX and other Unix-like Operating Systems it is also easily possible to use the following command to create a tunnel to a local port (in this case 3300)

ssh -L -N

While this command is running, you can connect to the MySQL server with host 'localhost' and port '3300'. To terminate the port forwarding, press ctrl-C in the terminal.

If you prefer the command to be run in the background, you can add -f to your command. To close this background process, you can use pgrep to acquire the pid of the process:

pgrep --list-full ssh | grep
12657 ssh -f -L -N

We can then kill the process using kill with the pid we acquired:

kill 12657