MySQL Thailand Guide
Contents
What is MySQL
MySQL is the world's most popular database management system (DBMS) for web applications, using SQL (Structured Query Language) to manage data. Open source and free — WordPress, Drupal, Joomla, Magento, and millions of other applications use MySQL.
MySQL vs MariaDB
MariaDB is a MySQL fork created by the original MySQL developers after Oracle acquired MySQL. Nearly 100% compatible with MySQL but with some different features. Many hosts use MariaDB instead of MySQL for its performance advantages in certain workloads.
Database User
In cPanel, go to MySQL Databases → Create Database → Create User → Assign User to Database and set permissions. Create users with minimal required permissions — never use the root user for applications.
What is Index
Index in MySQL is a data structure that speeds up queries — like a book index helping you find pages faster than reading the whole book. Columns used in WHERE, JOIN, and ORDER BY clauses should be indexed. No index = Full Table Scan = slow.
Optimize MySQL Configuration
Set innodb_buffer_pool_size to 50-70% of RAM for InnoDB tables (most WordPress use). Enable query_cache_size for read-heavy sites. Set max_connections appropriately for your traffic — not higher than necessary.
Backup: Backup MySQL Database
Database backup is critical. The simplest method is mysqldump, which exports an SQL file schedulable via Cron Job. In cPanel, use MySQL Backup in the Backups section or phpMyAdmin's Export function.
Security: MySQL
Disable remote root login, use minimal-privilege users, set strong passwords, block MySQL port (3306) from external access if remote access isn't needed, run mysql_secure_installation after new installations.
Query Performance
Enable slow_query_log to log queries taking longer than N seconds. Use EXPLAIN to see query plans and index usage. If EXPLAIN shows type=ALL, it's a Full Table Scan requiring index addition. Check SHOW PROCESSLIST for currently running queries.
What is phpMyAdmin
phpMyAdmin is a web-based MySQL management interface. Every cPanel/DirectAdmin installation includes phpMyAdmin, allowing table browsing, query execution, database import/export, index creation, and user management.