installmariadb
Install or upgrade MariaDB from the official repositories (default version 12.3, or a version you choose) and apply basic hardening
- Command:
/go/installmariadb - Category: Databases
- Required options: None
- Output: Package manager output and a few status messages
- Last updated: 2026-11-19
On this page: Overview · Quick start · Syntax · Output · Examples · Troubleshooting · Details · See also
Overview
/go/installmariadb installs MariaDB on a GoAdmio server, or upgrades an existing installation. It:
- checks that the server has at least 512 MB of RAM
- adds the MariaDB repository and installs the server, client, and backup packages
- enables the
mariadbservice at boot - applies GoAdmio's MariaDB configuration with
myand restarts the web server withweb - removes the test database, anonymous users, and remote
rootusers
It installs a fixed default version (12.3) unless you pass another one or the server has a pinned version. It does not install "the latest" version. See Version selection.
Run it with no arguments for a normal install or an in-place upgrade. Passing a version first removes MariaDB, so read Version selection before using it on a server that already has databases.
Quick start
# Install MariaDB with the default version (12.3), or upgrade the existing installation
/go/installmariadb
Syntax
/go/installmariadb [version]
| Argument | Required | Default | Notes |
|---|---|---|---|
version |
No | 12.3 |
A MariaDB release series such as 11.4. Running with a version first runs removemariadb. |
| Supported operating system | Package manager |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | dnf |
| Debian, Ubuntu | apt |
Nothing is installed on any other system, including OpenSUSE. See Unsupported systems.
Output
There is no summary or success message. You see the following messages, mixed with the output of dnf or apt.
| Message | When |
|---|---|
MariaDB requires at least 0.5 GB of RAM to install. |
The server has less than 512 MB of RAM. Exit status 1, nothing is changed. |
Upgrading MariaDB... |
The mariadb command already exists. |
A progress bar titled Installing MariaDB <version> |
New install on AlmaLinux, Rocky, CentOS, Red Hat, or Fedora. |
Installing MariaDB <version>... |
New install on Debian or Ubuntu. |
[!WARNING] The command does not check whether any install step worked. Its exit status is the status of the last SQL statement in the hardening step, not of the installation. Verify the result with
mariadb --versionandsystemctl status mariadb.
Examples
# Install, or upgrade within the pinned or default version
/go/installmariadb
# Install a specific version (removes MariaDB first)
/go/installmariadb 11.4
# Check whether the server has a pinned version
cat /usr/local/goadmio/mariadb.db
# Verify the installation
mariadb --version
systemctl status mariadb
# Verify the hardening
mariadb -e "SELECT User, Host FROM mysql.user;"
mariadb -e "SHOW DATABASES;"
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
MariaDB requires at least 0.5 GB of RAM to install. |
The server has less than 512 MB of RAM. The check uses total RAM, so a swap file doesn't help. | Add RAM, then run again. |
| The version you passed isn't what got installed | A pinned version in /usr/local/goadmio/mariadb.db overrides the argument (see Version selection). |
Check the file. Remove or edit it, then run again. |
| Databases are missing or MariaDB is stopped after passing a version | The command ran removemariadb first. This page doesn't cover what that command removes. |
Check removemariadb before using a version argument on a live server, and take a backup first. |
| Nothing was installed and a blank line was printed | The operating system is OpenSUSE, or isn't one of the supported systems. | Install MariaDB by hand. |
| Download or repository errors | The mirror or downloads.mariadb.com is unreachable, or the version doesn't exist. |
Check the network and the version number. On the dnf systems the command retries with MariaDB's setup script automatically. |
| On Red Hat, the first install attempt fails | The repository file uses the lowercase OS name, red hat, which contains a space. The URL is probably invalid. |
Wait for the retry with MariaDB's setup script, which runs when mariadb is still missing. |
apt errors about permissions |
Several apt commands run without sudo. |
Run the command as root. |
Errors such as Can't connect to local server through socket during hardening |
The mariadb service isn't running. The command enables it at boot but doesn't start it itself. |
Run systemctl start mariadb, then run the three statements in Hardening by hand. |
Anonymous or remote root users still exist |
The deletes aren't followed by FLUSH PRIVILEGES, so they may not apply until privileges are reloaded or the server restarts. |
Run mariadb -e "FLUSH PRIVILEGES;" or restart MariaDB. |
| Tables report errors after a major version upgrade | The command doesn't run mariadb-upgrade. |
Check whether mariadb-upgrade is needed after upgrading across versions. |
The command exited 0 but MariaDB isn't installed |
Exit status reflects only the last SQL statement. | Verify with mariadb --version. |
Details
Requirements
- Run it as
root. Theaptcommands don't usesudo. - At least 512 MB of RAM.
- Internet access to the MariaDB mirror and
downloads.mariadb.com. - The helper scripts
/go/function,removemariadb,my, andweb. - Back up your databases before upgrading, for example with
backupormysqlbackup.
Version selection
flowchart TD
A["installmariadb [version]"] --> B{"Version passed?"}
B -- "No" --> C["Use 12.3"]
B -- "Yes" --> D["Run removemariadb"]
D --> E["Use the passed version"]
C --> F{"/usr/local/goadmio/mariadb.db exists?"}
E --> F
F -- "Yes" --> G["Use the version stored in the file"]
F -- "No" --> H["Keep the chosen version"]
| Situation | Version installed | MariaDB removed first |
|---|---|---|
No argument, no mariadb.db |
12.3 |
No |
No argument, mariadb.db exists |
Version in the file | No |
Argument, no mariadb.db |
The argument | Yes |
Argument, mariadb.db exists |
Version in the file (the argument is ignored) | Yes |
The last row matters: the command removes MariaDB and then installs the version from the file, not the one you asked for. This script never writes mariadb.db, and this page doesn't cover whether removemariadb deletes it. Check the file before passing a version.
AlmaLinux, Rocky, CentOS, Red Hat, Fedora
- If the
mariadbcommand exists, printsUpgrading MariaDB...and removes themariadb-serverpackage. Otherwise it shows theInstalling MariaDB <version>progress bar. - Writes
/etc/yum.repos.d/mariadb.repo, replacing any existing file. It points athttps://mirrors.gigenet.com/mariadb/yum/<version>/<os>/$releasever/$basearch, withgpgcheck=1and the MariaDB signing key from the same mirror.<os>is the lowercase operating system name. - Runs
dnf clean all, then installsgalera-4,mariadb-server, andmariadb-backup. - If
mariadbstill isn't available, runsremovemariadb, then MariaDB's officialmariadb_repo_setupscript for the chosen version, cleans the cache, and installs the same three packages again.
Debian and Ubuntu
- If the
mariadbcommand exists, printsUpgrading MariaDB...and removesmariadb-server,mariadb-client, andmariadb-backupwithapt remove(configuration files are kept). Otherwise it printsInstalling MariaDB <version>.... - Installs
software-properties-common,dirmngr, andgnupg2. - Runs MariaDB's official
mariadb_repo_setupscript for the chosen version. - Runs
apt update, then installsmariadb-server,mariadb-client, andmariadb-backup.
[!WARNING]
mariadb_repo_setupis downloaded fromdownloads.mariadb.comand piped straight into a root shell. It is MariaDB's official script, but nothing here checks its contents before it runs.
Unsupported systems
On OpenSUSE the install step only prints a blank line. On any other system it does nothing at all. The command still goes on to run systemctl enable mariadb, my, web, and the hardening statements, which fail if MariaDB isn't installed.
Finishing up
After the install, the command:
- runs
systemctl enable mariadbso the service starts at boot - runs
my, with its output hidden, to apply GoAdmio's configuration - runs
webto restart or reload the active web server
It doesn't start the service itself. Whether MariaDB is running at the hardening step depends on the package and on my.
Hardening
The last step runs three statements as the database root user:
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.user WHERE user='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
These remove the sample test database, anonymous users, and root users that can connect from other hosts. The command doesn't set or change the root password (see mysqlset) and doesn't run FLUSH PRIVILEGES.
Log file
Each call appends a line with all its arguments to /var/log/go/installmariadb.log:
[Nov 19 12:00:00]# installmariadb 11.4
See also
| Command | Description |
|---|---|
removemariadb |
Remove MariaDB (called when you pass a version) |
my |
Optimize the my.cnf configuration for MySQL/MariaDB |
mysqlset |
Change the MySQL root password |
mysqlbackup |
Back up MariaDB/MySQL to a remote server via rsync |
backup |
Create a backup for all GoAdmio accounts (local and remote) |
repair |
Repair a MySQL database |
web |
Restart or reload the active web server |
package |
Install all base packages required by GoAdmio |