Database Management

Managing your databases is an essential part of running dynamic websites and applications. This section provides guides for common tasks around MySQL and MariaDB.

MySQL & MariaDB — The Basics

MySQL and MariaDB are the most widely used relational database systems for web servers. MariaDB is a fully compatible fork of MySQL and is shipped by default with many Linux distributions. Most commands and concepts are identical between both systems.

Command Line Access
The most direct method — connect via SSH and use the mysql client for full control over your databases.
phpMyAdmin Access
A web-based interface for database management — ideal for users who prefer not to work with SQL directly.
Plesk / cPanel Access
If you use a control panel, both Plesk and cPanel offer integrated database management tools.

Useful Commands at a Glance

The most common MySQL administration tasks can be handled with just a few commands:

TaskCommand
Log in as rootmysql -u root -p
List all databasesSHOW DATABASES;
Create a databaseCREATE DATABASE mydatabase;
Create a userCREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
Grant permissionsGRANT ALL ON db.* TO 'user'@'localhost';
Export database (backup)mysqldump -u root -p dbname > backup.sql
Import databasemysql -u root -p dbname < backup.sql

Available Guides

Detailed step-by-step guides for common database tasks:

Regular backups are essential. Back up your databases regularly using mysqldump or a dedicated backup tool like Acronis. A database failure without a recent backup can result in complete data loss.

Further Documentation

For advanced database administration, refer to the official documentation for each system.