How to use MariaDB with WordPress
Home » BLOG » WordPress » How to use MariaDB with WordPress

How to use MariaDB with WordPress

category:  WordPress

For the websites that run on WordPress for long time, MySQL is the main database. The default MySQL port is 3306.

When you develop the websites or web applications on your computer, often you will install the solution stack for your operation system. For example, I use WampServer for Windows. WampServer provides Apache(web server), PHP(programming language), MariaDB(relational database), MySQL(relational database) and PhpMyAdmin(a administration tool for MariaDB and MySQL). Some of my projects use MySQL and some uses MariaDB. For WampServer, MySQL is a default database. That means when I set the database configuration in WordPress, I may not identify the database port. But when I use MariaDB, I need to identify the database port in the WordPress config file.

How to set the MariaDB connection in WordPress

  • Simply open wp-config.php
  • Look for “define(‘DB_HOST’, ‘localhost’);
  • Add the MariaDB port which is 3307 – “define(‘DB_HOST’, ‘localhost:3307’);

And that should work. However, some servers may change the port number managed by your administrator. If you are trying the default port number and it doesn’t work. You must check the database port number at your server.

And that’s it for today.