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.
Prerequisites
- Basics understanding of E-Commerce Website.
- Basic knowledge of Databases.
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 150+ Data Sources like MariaDB and WooCommerce 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!
Here’s why you should explore Hevo:
- Streamlined Integration: Easily connect and integrate data from diverse sources.
- Effortless Transformations: Apply transformations without coding complexities.
- Real-Time Updates: Keep your data current with continuous synchronization.
Get Started with Hevo for Free
What is WooCommerce?
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.
What is MariaDB?
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.
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
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
- 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
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
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:
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;
- Now, you can connect WooCommerce MariaDB by installing the WooCommerce plugin on WordPress.
Integrate WooCommerce via MySQL to BigQuery
Integrate WooCommerce via MySQL to Snowflake
Integrate MariaDB to Redshift
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.
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.
- 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.
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.
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>
Move Your Data From Source To Destination Without Any Code!
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.
- 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.
- Activate the WooCommerce plugin after installing. Then, the plugin should automatically start the setup wizard. Follow the on-screen instructions.
- Continue the instructions until the setup is complete. Begin setting up your products to sell online.
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.
Use Cases For WooCommerce MariaDB Integration
- Real-Time Inventory Management: WooCommerce and MariaDB integration ensures real-time updates to inventory, keeping product stock synchronized across various sales channels and preventing overselling.
- Enhanced Reporting and Analytics: MariaDB’s powerful query capabilities allow businesses to generate detailed reports and perform advanced analytics on WooCommerce sales, customer behavior, and product performance.
- Scalable E-Commerce Database: MariaDB integration provides a scalable and reliable database solution for WooCommerce stores, supporting high transaction volumes as the business grows.
- Custom Data Automation: The integration enables automated data workflows between WooCommerce and other systems (e.g., CRM, ERP), reducing manual tasks and improving operational efficiency.
Conclusion
- The article discusses WooCommerce MariaDB Integration.
- While WordPress uses MySQL by default, you can replace it with a MariaDB server.
- WooCommerce is a plugin that converts a WordPress website into an online store for selling products.
- The article explains how to install WordPress and enable WooCommerce MariaDB Integration using Apache2 and PHP 7.2 on Ubuntu 16.04.
See the benefits of using MariaDB with WordPress for better performance and database efficiency.
Hevo Data provides an Automated No-code Data Pipeline that can help you transfer data from WooCommerce via MySQL without any code. Also, Hevo caters to 150+ data sources (including 60+ free sources) and can seamlessly load your data from MariaDB within minutes. It will make your life easier and make data migration hassle-free.
Want to take Hevo for a spin? Explore Hevo’s 14-day free trial and experience the feature-rich Hevo suite firsthand.
FAQ on WooCommerce MariaDB Integration
Can WordPress run on MariaDB?
Yes, WordPress can run on MariaDB. MariaDB is a popular open-source relational database management system (RDBMS) and is fully compatible with applications like WordPress that require MySQL databases.
Does WooCommerce use MySQL?
Yes, WooCommerce, which is a popular e-commerce plugin for WordPress, uses MySQL as its database backend.
How much RAM does WooCommerce need?
WordPress recommends a minimum of 512MB of RAM for a basic installation.
Why not use WooCommerce?
Some major reasons for not using WooCommerce are its complex setup and maintenance for beginners and the potential scalability challenges and costs associated with extensions.
Manjiri is a proficient technical writer and a data science enthusiast. She holds an M.Tech degree and leverages the knowledge acquired through that to write insightful content on AI, ML, and data engineering concepts. She enjoys breaking down the complex topics of data integration and other challenges in data engineering to help data professionals solve their everyday problems.