Files
mariadb-ubuntu/README.md
2025-10-23 15:36:05 +02:00

87 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MariaDB for Ubuntu 24.04 Server
[![OS](https://img.shields.io/badge/ubuntu-24.04-E95420)](#)
[![Shell](https://img.shields.io/badge/shell-bash-121011)](#)
[![DB](https://img.shields.io/badge/server-mariadb-003545)](#)
[![Auth](https://img.shields.io/badge/auth-socket-blue)](#)
[![License](https://img.shields.io/badge/License-MIT-green)](./LICENSE)
Automated Bash installer script for deploying MariaDB on Ubuntu 24.04 Server using **socket authentication** for the root account and creating a dedicated **local-only admin user** supplied at runtime.
This is a **production-focused installer**, not a demo.
---
### Preparing
Update your package index before running the installer:
```
sudo apt update -y
```
### Download the Script
Clone the repository from your Git server:
```
git clone https://git.x-files.dk/database/mariadb-ubuntu.git
```
```
cd mariadb-ubuntu
```
### Usage
Run the script with your chosen admin username and password:
```
sudo ./mariadbinstall -u <adminuser> -p <password>
```
### Example
```
sudo ./mariadbinstall -u mydbuser -p "StrongPassword123"
```
> **IMPORTANT**
> Always enclose the password in quotes if it contains special characters such as `$`, `!`, or `&`.
---
### Notes
- No `mysql_secure_installation` needed — this scipt is performing the equivalent hardening.
- The created admin user is **restricted to localhost only** for security.
- Root remains socket-authenticated by default.
> **On a side note**
> I know that on modern Ubuntu systems `mysql_secure_installation` isnt strictly necessary anymore — but a bit of paranoia helps me sleep at night. Thats why the script still runs through the whole `mysql_secure_installation` ritual. Its not that its required — I just dont want anyone blaming me because it *wasnt* done.
### Optional
Switching to Password Authentication. If you prefer **traditional password authentication** for the `root` user instead of socket authentication, you can switch manually:
```
sudo mariadb
```
Then run the following commands:
```
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
FLUSH PRIVILEGES;
```
From now on, `root` will require a password when connecting, and socket authentication will no longer be used.
> **Note:** This change is *optional*.
> Socket authentication is faster, safer, and the modern Ubuntu default.
> But if you prefer the old-school behavior, this is all it takes.
---
### More Information
More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-files.dk)
---
### License
Licensed under the [MIT License](./LICENSE).
---