RESOURCES HUB
Premium
Update System
First, update your package repository:
Code:
pkg update
pkg upgrade -y
Install MariaDB
Install MariaDB server and client (example with 10.6):
Code:
pkg install mariadb106-server mariadb106-client
If your source requires 10.5, use:
Code:
pkg install mariadb105-server mariadb105-client
Enable MariaDB at Boot
Make sure MariaDB starts automatically when the server boots:
Code:
sysrc mysql_enable="YES"
Initialize Database (FIRST TIME ONLY)
Before starting MariaDB for the first time, initialize it:
Code:
mysql_install_db --user=mysql --basedir=/usr/local --datadir=/var/db/mysql
Start MariaDB
Now start the service:
Code:
service mysql-server start
Check if it's running:
Code:
service mysql-server status
Secure Installation
Run the security setup:
Code:
mysql_secure_installation
Recommended answers:
- Switch to unix_socket authentication → No
- Set root password → Yes
- Remove anonymous users → Yes
- Disallow root login remotely → Yes
- Remove test database → Yes
- Reload privilege tables → Yes
Test Login
Try logging in:
Code:
mysql -u root -p
If you enter the MariaDB console, installation was successful
Exit with:
Code:
exit