Using MariaDB on localhost

MariaDB is an open-source branch of MySQL, and local stacks like XAMPP default to using MariaDB, connecting via localhost:3306.


MariaDB is developed by the original MySQL team and is highly compatible with MySQL. XAMPP and some LAMP installation packages use MariaDB as the default database instead of MySQL, providing an almost identical local development experience.

Default Connection

ItemTypical Value
Hostlocalhost
Port3306
Userroot
PasswordEmpty (default for XAMPP)

The connection strings for CMS and PHP applications are the same as those for MySQL, typically without the need to distinguish between drivers.

Starting and Verifying

XAMPP: Start MySQL (which is actually MariaDB) from the control panel.

Linux:

sudo systemctl start mariadb
sudo mysql -u root -p
SELECT VERSION();

Command Line Connection:

mysql -u root -p -h localhost

Web Management

Access phpMyAdmin at http://localhost/phpmyadmin, with an interface consistent with MySQL management.

Differences from MySQL

In daily local development, processes such as creating databases, importing SQL, and installing WordPress are the same as with MySQL. When migrating to a production environment, be aware of version and minor syntax differences, but local debugging is generally unaffected.

Frequently Asked Questions

Service Name Shows MySQL but is Actually MariaDB
The XAMPP panel still labels it as MySQL, but it is actually MariaDB underneath, and the connection method remains unchanged.

Port Conflicts
If there is already a MySQL/MariaDB instance running on your machine, avoid starting two sets of services simultaneously that occupy port 3306.

Summary

MariaDB runs on localhost at port 3306, connecting to host localhost, and is used in the same way as MySQL, serving as the default database in environments like XAMPP.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run