Setting Up WooCommerce MariaDB Integration: 2 Easy Methods

on Apache2, Database, Database Management Systems, e-commerce, MariaDB, MySQL, PHP, WooCommerce, WordPress • April 29th, 2022 • Write for Hevo

WooCommerce MariaDB

Organizations use WordPress due to its open-source and easy-to-use features for building websites. WordPress consists of plugins that can transform your simple website into an online e-commerce platform. One such plugin for starting an online store is the WooCommerce plugin. WooCommerce enables users to sell their products online using features like homepage designs, menus, secure payments and shipping options, site structure, and more. 

Although WooCommerce uses MySQL database by default, you can replace it with MariaDB. Connecting WooCommerce MariaDB can seamlessly perform database operations, ultimately increasing efficiency in online transactions. In this article, you will learn 2 methods to connect WooCommerce MariaDB and read about its features of them.

Table of Contents

Prerequisites

  • Basics understanding of E-Commerce Website.
  • Basic knowledge of Databases.

What is WooCommerce?

WooCommerce MariaDB: WooCommerce Logo | Hevo Data
Image Source

WooCommerce is the open-sourced WordPress plugin used for building your online e-commerce business. It is one of the most popular customizable platforms for building e-commerce websites. Earlier, WordPress was built to make blogging websites, but due to WooCommerce, organizations could now not only create dynamic websites but also start their online stores on WordPress with ease. Due to its effectiveness and low cost, WooCommerce has become a popular alternative to e-commerce CMS like Shopify.

Key Features of WooCommerce

  • Countless Themes: WooCommerce enables users to install their preferred theme specially designed for different industries. This allows users to quickly get started with their online store.
  • 400 Official Extensions: WooCommerce provides a wide range of extensions developers have built like Payments, Marketing, Shipping solutions, Accounting, Extension guides, and more.
  • Sell Anything: With WooCommerce, you can build your e-commerce website easily and sell any product, including physical products, digital downloads, subscriptions, and more.
  • Open-Source: WooCommerce is an open-sourced system, thereby allowing you to modify anything and everything on your e-commerce website. Consequently, you will have complete control over your website. 

To know more about WooCommerce, click here.

What is MariaDB?

WooCommerce MariaDB: MariaDB Logo | Hevo Data
Image Source

Developed in 2009, MariaDB is a fork of MySQL. In other words, MariaDB is a drop-in replacement for MySQL. Drop-in replacement allows users to substitute the standard MySQL server with the MariaDB server. MariaDB is invented by the developers of MySQL and aims to stay open source.

Since MariaDB is a relational database system that provides a SQL interface for accessing data, it is used to turn data into structured information in various applications, ranging from banking to e-commerce. MariaDB is fast, scalable, and robust and consists of a rich ecosystem of storage engines, plugins, and many other tools.

Key Features of MariaDB

Some of the main features of MariaDB are listed below:

  • JSON Support: With the wide use of JSON format to store data using applications, MariaDB offers JSON support that lets users insert JSON documents in a specially designated table column.
  • Sequence Storage Engine: The sequence storage engine in MariaDB create to create ascending or descending sequences of numbers with given starting, ending, and increment values.
  • Galera Cluster: The Galera Cluster technology in MariaDB allows to have synchronous data replication to keep the server live all the time, and prevent data loss. 

To know more about MariaDB, click here.

Replicate Data in Minutes Using Hevo’s No-Code Data Pipeline

Hevo Data, a Fully-managed Data Pipeline platform, can help you automate, simplify & enrich your data replication process in a few clicks. With Hevo’s wide variety of connectors and blazing-fast Data Pipelines, you can extract & load data from 100+ Data Sources straight into your Data Warehouse or any Databases. To further streamline and prepare your data for analysis, you can process and enrich raw granular data using Hevo’s robust & built-in Transformation Layer without writing a single line of code!

GET STARTED WITH HEVO FOR FREE

Hevo is the fastest, easiest, and most reliable data replication platform that will save your engineering bandwidth and time multifold. Try our 14-day full access free trial today to experience an entirely automated hassle-free Data Replication!

Methods to Set Up WooCommerce MariaDB Integration

Now that you have a brief knowledge about WooCommerce and MariaDB. In this section, you will learn about two different ways of connecting WooCommerce MariaDB. The following methods and their steps for WooCommerce MariaDB Integration are listed below: 

Method 1: Connecting WooCommerce MariaDB by Replacing MySQL With MariaDB in WordPress

WordPress uses a MySQL database as a backend. But, since MariaDB was developed as a replacement for the MySQL database server, MySQL can be replaced with the MariaDB database in WordPress. As a result, this will also connect WooCommerce MariaDB. Follow the below steps for WooCommerce MariaDB Integration by replacing MySQL in WordPress with MariaDB Database.

Step 1: Establish an SSH Connection

  • You can start by migrating your existing MySQL database systems to MariaDB database systems. Initially, establish an SSH connection to your MySQL database server. 
  • Then stop the MySQL service using the below command.
/etc/init.d/mysqld stop
  • Output:
Stopping mysqld: [ OK ].
  • Before migrating, backup your databases.
cp /var/lib/mysql/ backup/ -r
cp /etc/my.cnf backup/

Step 2: MySQL Service Removal

  • After backing up the MySQL databases, you need to remove the MySQL Service. 
  • Get the list of all the installed MySQL packages using the below command.
rpm -qa | grep mysql
  • Output:
WooCommerce MariaDB: List of MtSQL Packages Installed | Hevo Data
Image Source
  • Uninstall the MySQL client and server, development tools, and libraries. 
yum remove mysql mysql-server mysql-devel mysql-libs
  • Verify your distribution and Kernel versions.
cat /etc/redhat-release
  • Output: 
WooCommerce MariaDB: Verifying Kernel Version | Hevo Data
Image Source

Step 3: Repository File Generation

  • You need to generate the correct MariaDB repository file and store it under the /etc/yum.repos.d/ folder using the below command.
cat MariaDB.repo
  • Output:
WooCommerce MariaDB: Storing MariaDB Repo | Hevo Data
Image Source

Step 4: Install the MariaDB Database

  • As shown above, in the repository file, the URL of the GPG (GNU Privacy Guard) key is included. The URL is to verify the integrity of the package that is downloaded.
yum clean all
yum install MariaDB-server MariaDB-client
  • Yum is used to retrieving and import the GPG key in the MariaDB installation process. It is also used to install the MariaDB server and client applications with the MariaDB-compact and MariaDB-common dependencies.
  • Start the MariaDB server and verify its service as follows.
/etc/init.d/mysql start

Output:

WooCommerce MariaDB: Starting MariaDB Server | Hevo Data
Image Source

Step 5: Verification of WordPress Imports

  • To verify that the MariaDB is correctly connected with WordPress, you can run a few queries.
MariaDB [(none)]> use wp1;
MariaDB [wp1]> explain wp_options;
  • Output:
WooCommerce MariaDB: Verifying WordPredd MariaDB Connection | Hevo Data
Image Source
  • Now, you can connect WooCommerce MariaDB by installing the WooCommerce plugin on WordPress.

What Makes Hevo’s ETL Process Best-In-Class

Providing a high-quality ETL solution can be a difficult task if you have a large volume of data. Hevo’s automated, No-code platform empowers you with everything you need to have for a smooth data replication experience.

Check out what makes Hevo amazing:

  • Fully Managed: Hevo requires no management and maintenance as it is a fully automated platform.
  • Data Transformation: Hevo provides a simple interface to perfect, modify, and enrich the data you want to transfer.
  • Faster Insight Generation: Hevo offers near real-time data replication so you have access to real-time insight generation and faster decision making. 
  • Schema Management: Hevo can automatically detect the schema of the incoming data and map it to the destination schema.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources (with 40+ free sources) that can help you scale your data infrastructure as required.
  • Live Support: Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
Sign up here for a 14-day free trial!

Method 2: Connecting WooCommerce MariaDB by Installing WordPress on Ubuntu

Follow the below steps to connect WooCommerce MariaDB using Apache2, PHP 7.2 on Ubuntu 16. 04, and enable the WooCommerce plugin.

Step 1: Install the Apache 2 HTTP Server on Ubuntu 16.04

  • WordPress works seamlessly on Apache2 HTTP Server. Therefore, install Apache2 HTTP Server.
  • Install the Apache2 HTTP Server in Ubuntu.
sudo apt update
sudo apt install apache2
  • Start, stop, and enable the Apache2 HTTP Server for WooCommerce MariaDB Integration.
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
  • Open your web browser and browse the server hostname or IP address to test the Apache2 setup. You should see the Apache2 default page, as shown below. 
WooCommerce MariaDB: Apache2 default page | Hevo Data
Image Source

Step 2: Install MariaDB Database Server

  • Install the MariaDB Database Server.
sudo apt-get install mariadb-server mariadb-client
  • Start, stop, and enable the MariaDB service.

On Ubuntu 16.04.

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

On Ubuntu 17.10 and 18.04.

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
  • Secure your MariaDB server using a root password.
sudo mysql_secure_installation
  • Use the below contents to answer the questions in the installation process.
WooCommerce MariaDB: Installation Process Settings | Hevo Data
Image Source
  • Restart the MariaDB Serve
  • Verify the MariaDB Server is installed.
sudo mysql -u root -p
  • Type the root password you just created in the above steps. 
WooCommerce MariaDB: Restarting MariaDB Server | Hevo Data
Image Source

Step 3: Install PHP 7.2 and Related Modules

  • PHP 7.2 is not directly available in Ubuntu default repositories. Therefore, to install PHP 7.2, you need to use third-party repositories.
  • Add the third-party repositories to PHP 7.2.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
  • Update the above repositories to PHP 7.2 with the below command.
sudo apt update
  • Install PHP 7.2 and related modules for WooCommerce MariaDB Integration.
sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-sqlite3 php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip
  • Open the PHP 7.2 default config file for Apache2.
sudo nano /etc/php/7.2/apache2/php.ini
  • Make the below changes in the config file to apply settings in your environments for WooCommerce MariaDB Integration.
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
  • Save the file and close it.

Step 4: Restart Apache2

  • Restart the Apache2 Server to reload the configurations.
sudo systemctl restart apache2.service
  • Create a phpinfo.php file in the Apache2 root directory to test the PHP 7.2 settings with Apache2.
sudo nano /var/www/html/phpinfo.php
  • Type the below content and save the file.
<?php phpinfo( ); ?>
  • Save the file and then browse to your server hostname by /phpinfo.php.
  • By entering http://localhost/phpinfo.php in the web browser, you will get the below window.
WooCommerce MariaDB: Opening PHP on Localhost | Hevo Data
Image Source

Step 5: Create WordPress Database

  • Start the database server and enter the root password for it.
sudo mysql -u root -p
  • Create a blank database called wp_database for WooCommerce MariaDB Integration..
CREATE DATABASE wp_database;
  • Create a database user with wp_user name with the new password.
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'type_password_here';
  • Grant full access to the database.
GRANT ALL ON wp_database.* TO 'wp_user'@'localhost' IDENTIFIED BY 'type_user_password_here' WITH GRANT OPTION;
  • Save your changes and exit.
FLUSH PRIVILEGES;
EXIT;

Step 6: Configure WordPress Site

  • Create a new configuration file for your WordPress site called wordpress.conf.
sudo nano /etc/apache2/sites-available/wordpress.conf
  • Copy and paste the following code into wordpress.conf file. (Replace www.example.com with your domain name.)
<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/wordpress/
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/html/wordpress/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  • Save the file and exit.

Step 7: Enable WordPress Apache2 Site

  • Enable the WordPress Apache2 Site.
sudo a2ensite wordpress.conf
sudo a2enmod rewrite

Step 8: Install WordPress

  • Download the latest WordPress using the below command. 
cd /tmp && wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
sudo mv wordpress /var/www/html/wordpress
  • Set the permissions for the WordPress root directory.
sudo chown -R www-data:www-data /var/www/html/wordpress/
sudo chmod -R 755 /var/www/html/wordpress/
  • Create the WordPress wp-config.php file using the following commands. This file is the default configuration file for WordPress.
sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
  • Open the WordPress Configuration file.
sudo nano /var/www/html/wordpress/wp-config.php
  • Enter the below details for your database in the same file and save.
define('DB_NAME', 'wp_database');
define('DB_USER', 'wp_user');
define('DB_PASSWORD', 'new_password_here');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

Step 9: Reload the Apache2 Web Server Settings

sudo systemctl reload apache2.service
  • Open your web browser. Go to the server IP address or domain name to continue with the WordPress setup.
http://example.com 
  • You will see the WordPress setup wizard. 
WooCommerce MariaDB: WordPress Installation Wizard | Hevo Data
Image Source
  • You need to create the site administrator account with the password. Then, log in to your WordPress account to manage WordPress.
http://example.com/wp-admin/
  • When logged in to the WordPress dashboard, go to Plugins > Add New. Search for WooCommerce and click on Install Now.
WooCommerce MariaDB: Installing WooCommerce Plugin | Hevo Data
Image Source
  • Activate the WooCommerce plugin after installing. Then, the plugin should automatically start the setup wizard. Follow the on-screen instructions.
WooCommerce MariaDB: Configuring WooCommerce Store | Hevo Data
Image Source
  • Continue the instructions until the setup is complete. Begin setting up your products to sell online.
WooCommerce MariaDB: Configuring Extra Options | Hevo Data
Image Source
WooCommerce MariaDB: Finished Installing WooCommerce on WordPress | Hevo Data
Image Source

That’s it! You have completed the WooCommerce MariaDB Integration with 2 different methods. You can use any of the methods as convenient to you.

Conclusion

In this article, you learned about the WooCommerce MariaDB Integration. Although WordPress uses a MySQL database server by default, you can replace the MySQL database server with a MariaDB server. WooCommerce plugin is used to convert your WordPress website into an online store where you can sell your products. This article focuses on installing WordPress and enabling the WooCommerce MariaDB Integration using Apache2, and PHP 7.2 on Ubuntu 16.04.

Hevo Data provides an Automated No-code Data Pipeline that can help you transfer data from WooCommerce via MySQL. Also, Hevo caters to 100+ data sources (including 40+ free sources) and can seamlessly load your data from MariaDB within minutes. Hevo’s Data Pipeline enriches your data and manages the transfer process in a fully automated and secure manner without having to write any code. It will make your life easier and make data migration hassle-free.

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. 

Share your experience of learning about WooCommerce MariaDB Integration in the comments section below! 

No-code Data Pipeline For your Data Warehouse