Skip to main content

MySQL / MariaDB

Updated: October 30, 2026
By Willya Randika

MySQL and MariaDB are relational database servers. SQL is the language you use to ask for and change data, while the server is the software that runs that language and stores the result. A dynamic site keeps content, users, orders, and settings in the database, apart from the theme files in the document root. PHP connects with four values: host, database name, user, and password. A backup that copies only files can never restore data that lives in tables.

Three terms people mix up

TermOn a hosting account
DatabaseThe container that holds your tables
DB userAn account allowed to reach one database, not your cPanel login
HostThe source address permitted to connect, often localhost
PrivilegeRights on one database, such as SELECT or INSERT

Reusing one user across every app is the usual shortcut. One database plus one narrowly granted user is cleaner, because you can revoke access without touching anything else.

Where credentials live

On shared hosting you create databases and users in the control panel, then grant each user to a specific database. The working credentials sit in the application config, in wp-config.php for WordPress. The host is normally localhost because PHP opens the connection from the same server. Reaching the database from your laptop only works when the plan allows remote MySQL and your IP is listed.

Reading what the database is doing

When a page turns slow, ask what the server is working on. Run SHOW PROCESSLIST to see every connection, the database it touches, the active query, and the runtime in seconds. The State column says what it is waiting on, such as Sending data or Copying to tmp table. One slow query repeating across many connections means the query is the problem, not PHP. Heavy queries on large tables usually need an index, see MySQL Index.

Uncached traffic reads the same rows

WordPress without a page cache makes every request run PHP, open a connection, and reread the same rows from the posts and options tables. A traffic spike therefore means many parallel connections competing for slots under max_connections. When the limit is reached the server refuses new ones with a too many connections error, and on shared hosting that often surfaces as Error 508. Cut connections per request with a page cache or an object cache such as Redis, and read up on connection pooling. The connection limit varies per host and is rarely visible in the panel, so confirm the real number with your provider before you assume one.

Connections that never go away

Persistent connections and oversized pools keep slots open while the database sits idle. An idle connection still counts against max_connections until wait_timeout closes it, and that timeout differs between hosts and is often not editable on shared plans. A spike can then fail not from slow queries but because old connections hold every slot. Check the process list at peak traffic and make sure idle connections are actually released.

FAQ

Should I pick MySQL or MariaDB?

On shared hosting the provider already chose. For common apps the two behave alike, so follow the version your host supports and test before migrating.

Can I connect from my laptop?

Only when remote MySQL is enabled and your IP is allowed. Many shared plans accept localhost connections from inside the server and nothing else.

What does too many connections mean?

The server has no free slots under max_connections, so new connections are refused. Look for traffic spikes, slow queries holding connections, or pools and persistent connections that never close.

Disclaimer: Hosting Wiki articles are prepared for educational and reference purposes. Hosting technology keeps evolving, so some technical details may change over time.