# How to Update MariaDB or MySQL on an xCloud Server via SSH

> Update MariaDB 11.8 or MySQL 8.4 to the newest patch release on your xCloud server over SSH, with a safety backup first and only seconds of database downtime.

This guide updates MariaDB or MySQL on your xCloud server to the newest **patch release of the same version**, for example MariaDB 11.8.6 to 11.8.9. Patch releases fix bugs and security issues, and your data stays as it is.

Plan about 15 minutes. Your sites lose their database for a few seconds while it restarts (10 to 15 seconds in our tests), so pick a quiet time.

![Animated walkthrough: opening the xCloud terminal, previewing the update, backing up, updating MariaDB from 11.8.6 to 11.8.9 and checking the result](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-steps.gif)

## Prerequisites

This guide is for patch updates only. It does not move you to a new major version.

| Database on your server | Can you use this guide? |
| --- | --- |
| MariaDB 11.8 | Yes. It updates to the newest 11.8.x. |
| MySQL 8.4 LTS | Yes. It updates to the newest 8.4.x. |
| MariaDB 10.6 | No. Community support for MariaDB 10.6 ended on 6 July 2026. See [Moving to a new major version](#moving-to-a-new-major-version). |
| MySQL 8.0 | No. MySQL 8.0 has reached end of life. See [Moving to a new major version](#moving-to-a-new-major-version). |

You also need:

- Root access to the server. Step 1 shows two ways to get it.
- A quiet time for a short database restart.
- Recent backups of your sites, including their databases.
- Free disk space larger than your databases, for the safety copy in Step 3.

## Step 1: Connect to your server

Use one of these two ways. Both give you root access.

**Option A: the xCloud web terminal (easiest).** Open your server in xCloud and click **'Open Terminal'**. A terminal opens in a new browser tab, logged in as root. See [how to access the web terminal in xCloud](/docs/access-web-terminal-in-xcloud/).

![The Refresh, Open Terminal, Actions and New Site buttons at the top of a server page in xCloud](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-1.png)

**Option B: SSH from your computer.**

1. In xCloud, open your server and go to **'Management' → 'Sudo Users' → 'Add Sudo User'**. See [sudo users and site users in xCloud](/docs/usudo-users-and-site-users-in-xcloud/).
2. Enter a **'Sudo User Name'** and a **'Sudo Password'**, pick your SSH key, and click **'Save'**. No key in the list? See [how to generate and add SSH keys in xCloud](/docs/how-to-generate-and-add-ssh-keys-in-xcloud/).
3. Connect from your computer, then switch to root:

```bash
ssh YOUR_SUDO_USER@SERVER_IP
sudo -i
```

![The Add Sudo User form under Management, Sudo Users, with the Sudo User Name, Sudo Password and SSH key fields](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-2.png)

**Expected result:** a prompt that ends in `#`, for example `root@demo-server-01:~#`.

If the connection does not open and you limited SSH to certain IP addresses on your server, use the other option or contact support.

## Step 2: Check your version and preview the update

These commands change nothing. They show what you have and what the update would install.

**MariaDB:**

```bash
mariadb --version
apt-get update
PKGS=$(dpkg -l | awk '/^ii/ && $2 ~ /^(mariadb|galera|libmariadb|mysql-common)/ {print $2}')
apt-get -s install --only-upgrade $PKGS | grep -E '^Inst|upgraded'
```

**MySQL:**

```bash
mysql --version
apt-get update
PKGS=$(dpkg -l | awk '/^ii/ && $2 ~ /^(mysql-|libmysqlclient)/ && $2 != "mysql-apt-config" {print $2}')
apt-get -s install --only-upgrade $PKGS | grep -E '^Inst|upgraded'
```

The `-s` flag means "simulate": nothing is installed.

**Expected result:**

- Each `Inst` line shows a database package and its new version. The version number changes only after the last dot, for example 11.8.6 to 11.8.9.
- One small new package that the database needs (such as `stunnel4`) may appear. That is fine.
- The summary line says **0 to remove**. If it wants to remove anything, stop and contact support.
- The "not upgraded" number on that line counts other packages on your server. This guide leaves them alone on purpose, so any number there is fine.
- No `Inst` lines means you already have the newest patch. You are done.

![The update preview: MariaDB 11.8.6 installed, 10 packages to upgrade, 1 new package and 0 to remove](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-3.png)

## Step 3: Back up before you update

Take two backups: one in xCloud and one on the server. The update rarely fails, but a backup makes any problem easy to undo.

1. **In xCloud:** open each site, go to its backups, and click **'Backup Now'**. Wait until it finishes.
2. **Check free disk space.** The first number is your database size. The free space (`Avail`) must be larger.

```bash
du -sh /var/lib/mysql
df -h /
```

3. **Copy the database root password.** In xCloud, open your server and go to **'Others' → 'Database' → 'MySQL Root Password'**, then click **'Copy'**. MariaDB servers use the same field. See [how to find the MySQL root password in xCloud](/docs/find-mysql-root-password-in-xcloud/).

![The Database card on the server's Others page, with the masked MySQL Root Password and its Copy button](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-4.png)

4. **Make a safety copy on the server.** Paste the password when it asks. Nothing shows while you paste; that is normal.

**MariaDB:**

```bash
mariadb-dump -u root -p --all-databases --single-transaction --routines --events --triggers | gzip > /root/db-before-update-$(date +%F).sql.gz
```

**MySQL:**

```bash
mysqldump -u root -p --all-databases --single-transaction --routines --events --triggers | gzip > /root/db-before-update-$(date +%F).sql.gz
```

5. **Check that the copy is good:**

```bash
gzip -t /root/db-before-update-*.sql.gz && ls -lh /root/db-before-update-*.sql.gz
```

**Expected result:** no error, and a file bigger than a few KB. If you see an error, stop here and contact support.

![Disk checks, the backup command with its password prompt, and a 1.4 MB safety copy that passed the check](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-5.png)

## Step 4: Update only the database

This updates the database packages and nothing else. The database restarts once by itself, and your sites wait a few seconds for it.

**MariaDB:**

```bash
PKGS=$(dpkg -l | awk '/^ii/ && $2 ~ /^(mariadb|galera|libmariadb|mysql-common)/ {print $2}')
DEBIAN_FRONTEND=noninteractive apt-get install --only-upgrade -y -o Dpkg::Options::=--force-confold $PKGS
```

**MySQL:**

```bash
PKGS=$(dpkg -l | awk '/^ii/ && $2 ~ /^(mysql-|libmysqlclient)/ && $2 != "mysql-apt-config" {print $2}')
DEBIAN_FRONTEND=noninteractive apt-get install --only-upgrade -y -o Dpkg::Options::=--force-confold $PKGS
```

What the options do:

- `--only-upgrade` updates packages you already have. It installs nothing new except what the database itself needs.
- `--force-confold` keeps your current settings files. xCloud tuned them for your server, so they must stay.

**Expected result:** the prompt comes back after about a minute. For files that xCloud changed, the output says **Using current old file as you requested**, which means your settings are kept.

![The end of the update: new MariaDB 11.8.9 packages set up and the existing 50-server.cnf settings kept](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-6.png)

Do not run `apt upgrade` or `apt full-upgrade` for this. Those update every package on the server and can need a reboot.

## Step 5: Check that everything works

**MariaDB:**

```bash
mariadb --version
systemctl is-active mariadb
mariadb -u root -p -e "SELECT VERSION();"
```

**MySQL:**

```bash
mysql --version
systemctl is-active mysql
mysql -u root -p -e "SELECT VERSION();"
```

**Expected result:** the new version number and the word `active`.

![The checks after the update: MariaDB 11.8.9, the service active, and SELECT VERSION showing 11.8.9](/_landing/docs/update-mariadb-or-mysql-on-xcloud-server-via-ssh-image-7.png)

Then open each of your sites in a browser and log in to its admin area (for example `/wp-admin` on WordPress). If pages load, the update is done.

Keep the safety copy for a few days. When you are sure all is well, delete it to free the space:

```bash
rm /root/db-before-update-*.sql.gz
```

## If something goes wrong

| Symptom | Likely cause | What to do |
| --- | --- | --- |
| The database does not start | Usually a full disk | Run `journalctl -u mariadb -n 50 --no-pager` (use `mysql` for MySQL) and `df -h /`. Free some space, then run `systemctl restart mariadb`. See [database keeps stopping](/docs/database-keeps-stopping-fix-out-of-memory-and-disk-full-crashes/). |
| A site shows a database error | The database is still starting | Wait one minute and reload. If the error stays, check that the database is `active` (Step 5). |
| Data looks wrong or missing | Very rare with patch updates | Do not restore the safety copy on your own: it brings back every database at once, including database users. Contact support. Restoring one site from its xCloud backup is usually the safer fix. |

When you contact support, include the output of the `journalctl` command above and the versions from Step 2. Never share your database password.

## Moving to a new major version

A major upgrade (MariaDB 10.6 to 11.8, or MySQL 8.0 to 8.4) changes how the database stores data. Do not do it in place on a live server. The safe way is a new server:

1. Create a new server in xCloud and choose the newer database version.
2. Copy your sites to it. See [how to clone a full server with xCloud](/docs/how-to-clone-full-server-with-xcloud/).
3. Check the sites on the new server, then point your domains to it.
4. Delete the old server when you no longer need it.

The new server has a new IP address, so plan the DNS change for a quiet time.

## Frequently asked questions

**Does this update restart my server or my sites?**
No server reboot is needed. Only the database restarts, once, and pages that need it show an error for a few seconds (10 to 15 seconds in our tests).

**Don't xCloud's automatic security updates already update MariaDB or MySQL?**
Not yet. Automatic security updates install Ubuntu's security fixes. MariaDB and MySQL come from their vendors' own package sources, which those updates do not include.

**Can I use this guide to move from MariaDB 10.6 to 11.8 or from MySQL 8.0 to 8.4?**
No. That is a major upgrade. Create a new server with the newer database and clone your sites to it instead.

**Can xCloud update the database for me?**
Yes. Contact xCloud support with your server name and a time that suits you.

## References

- xCloud: [How Automated Security Updates and Auto Reboot Work in xCloud](/docs/how-automated-security-updates-and-auto-reboot-work-in-xcloud/)
- MariaDB: [MariaDB 11.8.9 release notes](https://mariadb.com/kb/en/mariadb-11-8-9-release-notes/)
- MariaDB: [Maintenance policy and end-of-life dates](https://mariadb.org/about/#maintenance-policy)

If you run into any issues with this update, feel free to reach out to our [support team](/docs/access-built-in-support-portal-in-xcloud/) for help.
