Page cover

Databases

This guide provides step-by-step instructions to help users set up databases and manage access directly on virtual machines using console access or SSH tools like PuTTY.

Below is a list of all supported databases along with their compatible operating systems. You can click on each tab to view more details.

MYSQL [Ubuntu 24.04/22.04]

Create User & Database, Then Run Security Script

Step 1: Run the Security Script

sudo mysql_secure_installation

You’ll be prompted to:

  • Set a root password (if not already set)

  • Remove anonymous users

  • Disallow remote root login

  • Remove the test database

  • Reload privilege tables

Tip: Press Y to accept the recommended security settings.

Step 2: Log In to MySQL

With the admin password set, you can now access your MySQL instance by running the following command:

sudo mysql -u root -p
  • Username: root

  • Password: (enter the password you set in Step 1)

MYSQL [Alma Linux 9.5/ 8.5]

Create User & Database, Then Run Security Script

Run the MySQL Security Script:

sudo mysql_secure_installation

You’ll be prompted to:

  • Change the root password

  • Remove anonymous users

  • Disallow remote root login

  • Remove the test database

  • Reload privilege tables

Tip: Press Y to accept the recommended security settings.

Log In to MySQL

mysql -u root -p

Enter the root password you set during the security script.

Configure MySQL for Remote Access

sudo nano /etc/my.cnf

Find the line with bind-address and change it to:

bind-address = 0.0.0.0

Save and exit the file.

Restart MySQL Service

sudo systemctl restart mysqld

Open MySQL Port in Firewall

sudo firewall-cmd --permanent --add-service=mysql
sudo firewall-cmd --reload

Verify MySQL Access

sudo mysql -u root -p

Username: root Password: (your admin password)

PostgreSQL [Ubuntu 24.04]

Create User & Database

sudo -i -u postgres
createuser --interactive
createdb mydatabase

Or via SQL:

psql
CREATE USER myuser WITH PASSWORD 'mypassword';
CREATE DATABASE mydb OWNER myuser;
\q

Optional: Enable Remote Access

sudo nano /etc/postgresql/16/main/postgresql.conf
Set:
listen_addresses = '*'
sudo nano /etc/postgresql/16/main/pg_hba.conf
Add:
host all all 0.0.0.0/0 md5
sudo systemctl restart postgresql
MariaDB [Ubuntu24.04/22.04]

Create User & Database, Then Run Security Script

Run the Security Script

sudo mysql_secure_installation

You’ll be prompted to:

  • Set a root password (if not already set)

  • Remove anonymous users

  • Disallow remote root login

  • Remove the test database

  • Reload privilege tables

Tip: Press Y to accept the recommended security settings.

Log In to MariaDB

sudo mariadb -u root -p

Username: root Password: (enter the password you set above)

Enable Remote Access (Optional)

sudo nano /etc/my.cnf

Locate the bind-address line and update it to:

bind-address = 0.0.0.0

Save and exit the file.

Restart MariaDB Service

sudo systemctl restart mysqld

Open MariaDB Port in Firewall

sudo firewall-cmd --permanent --add-service=mysql
sudo firewall-cmd --reload
MongoDB [Ubuntu 24.04/22.04]

In order to start and enable service:

sudo systemctl enable mongod
sudo systemctl start mongod
sudo systemctl status mongod

With an admin without password you can now access your MongoDB instance, run command.

Launch the MongoDB Shell

mongosh

View Available Databases

Once inside the shell, run:

show databases;

Expected Output:

admin   40.00 KiB
config  12.00 KiB
local   72.00 KiB

Exit the MongoDB Shell

Press Ctrl + Z to exit the shell and return to the command prompt.

For secure access to Mongo DB (Optional)

Step 1: Start MongoDB Shell

mongosh

Step 2: Switch to admin Database

use admin

Step 3: Create an Admin User with Password

Replace YourStrongPassword123! with your own strong password.

db.createUser({
  user: "admin",
  pwd: "YourStrongPassword123!",
  roles: [ { role: "root", db: "admin" } ]
})

Step 4: Enable Authentication

Edit the MongoDB config file:

sudo nano /etc/mongod.conf

Find the section:

#security: 

Uncomment and enable:

security:authorization: enabled 

Save and exit (CTRL+O, CTRL+X).

Step 5: Restart MongoDB

sudo systemctl restart mongod

Step 6: Log in with Password

Now you must use your username and password:

mongosh -u admin -p YourStrongPassword123! --authenticationDatabase admin
MongoDB [Alma Linux 9.5/8.10]

In order to start and enable service:

sudo systemctl enable mongod

sudo systemctl start mongod

sudo systemctl status mongod

Open Firewall (Optional for remote access):

sudo firewall-cmd --zone=public --add-port=27017/tcp --permanent
sudo firewall-cmd –reload

With an admin without password you can now access your MongoDB instance, run command.

Launch the MongoDB Shell

mongosh

View Available Databases

Once inside the shell, run:

show databases;

Expected Output:

admin   40.00 KiB
config  12.00 KiB
local   72.00 KiB

Exit the MongoDB Shell

Press Ctrl + Z to exit the shell and return to the command prompt.

For secure access to Mongo DB (Optional)

Step 1: Start MongoDB Shell

mongosh

Step 2: Switch to admin Database

use admin

Step 3: Create an Admin User with Password

Replace YourStrongPassword123! with your own strong password.

db.createUser({
  user: "admin",
  pwd: "YourStrongPassword123!",
  roles: [ { role: "root", db: "admin" } ]
})

Step 4: Enable Authentication

Edit the MongoDB config file:

sudo nano /etc/mongod.conf

Find the section:

#security: 

Uncomment and enable:

security:authorization: enabled 

Save and exit (CTRL+O, CTRL+X).

Step 5: Restart MongoDB

sudo systemctl restart mongod

Step 6: Log in with Password

Now you must use your username and password:

mongosh -u admin -p YourStrongPassword123! --authenticationDatabase admin
Redis Server [Ubuntu24.04/22.04] / AlmaLinux 9.5/8.10

You can access your Redis instance using the default admin user without a password. To verify connectivity and run basic commands, please follow the steps below:

Launch the Redis CLI:

redis-cli

At the prompt, test the connection by running:

ping

You should see the response:

PONG

To exit the Redis CLI, simply type: exit

LAMP [Ubuntu24.04/22.04]

Getting Started After Deploying LAMP

LAMP MOTD

On your first SSH login to the VM or launch of the VM console of your PhpMyAdmin VM 1-Click; you will be greeted by a message of the day which includes the admin password for your PhpMyAdmin instance:

LAMP passwords location

If for any reason, you are unable to access the message of the day, you can get the admin password by simply reading the /root/.neoncloud_password file in your VM:

PhpMyAdmin login screen

With an admin password, you can now access your PhpMyAdmin instance, by visiting:

http://<your_server_IP>/phpmyadmin

Username → admin Password → StrongPass123!

Last updated

Was this helpful?