Arch Linux Database Servers - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Arch Linux Database Servers Guide
Complete beginner-friendly guide to database servers on Arch Linux, including PostgreSQL, MySQL, MariaDB, MongoDB, and SQLite.
Table of Contents
PostgreSQL
Install PostgreSQL
Install PostgreSQL:
# Install PostgreSQL
sudo pacman -S postgresql
# Initialize database
sudo -u postgres initdb -D /var/lib/postgres/data
# Enable service
sudo systemctl enable postgresql
sudo systemctl start postgresql
PostgreSQL Configuration
Configure PostgreSQL:
# Edit config
sudo vim /var/lib/postgres/data/postgresql.conf
# Edit pg_hba.conf
sudo vim /var/lib/postgres/data/pg_hba.conf
MySQL/MariaDB
Install MariaDB
Install MariaDB:
# Install MariaDB
sudo pacman -S mariadb
# Initialize database
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# Enable service
sudo systemctl enable mariadb
sudo systemctl start mariadb
# Secure installation
sudo mysql_secure_installation
MySQL Client
Use MySQL:
# Connect
mysql -u root -p
# Or MariaDB
mariadb -u root -p
MongoDB
Install MongoDB
Install MongoDB:
# Install MongoDB
yay -S mongodb-bin
# Enable service
sudo systemctl enable mongodb
sudo systemctl start mongodb
MongoDB Client
Use MongoDB:
# Connect
mongo
# Or mongosh
mongosh
SQLite
Install SQLite
Install SQLite:
# Install SQLite
sudo pacman -S sqlite
# Create database
sqlite3 database.db
# Or use in applications
Database Tools
phpPgAdmin
Install phpPgAdmin:
# Install phpPgAdmin
sudo pacman -S phppgadmin
phpMyAdmin
Install phpMyAdmin:
# Install phpMyAdmin
sudo pacman -S phpmyadmin
DBeaver
Install DBeaver:
# Install DBeaver
yay -S dbeaver
Summary
This guide covered PostgreSQL, MySQL/MariaDB, MongoDB, SQLite, and database tools.
Next Steps
- Arch Linux Development Environment - Development
- Arch Linux Web Servers - Web servers
- ArchWiki Database Servers: https://wiki.archlinux.org/title/List_of_applications/Databases
This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.