Identify whether you are using MariaDB or MySQL using phpMyAdmin (through cPanel here)

When it comes to relational databases I used to think right there’s

    MySQL
    SQL Server
    PostGres
    Oracle

I know there is MariaDB as well and I know that is a direct substitute for MySQL I think I might be using it but you know what I’m not really sure. Whenever I look things up I quite often look for MySQL and to date any information obtained using those parameters have worked when executed against my databases through phpMyAdmin.

Should I be using MariaDB or hang on – am I???

Well turns out they are so similar that you might be using and not even know it. Turns out my hosting company uses MariaDB instead of MySQL but you might be under the impression you are still using MySQL. Why? Because if you are like me and you are using cPanel all the branding is still MySQL. I suspect this is actually very usual for anyone using cPanel.

Here’s my Database panel in cPanel

MySQL written all over the place even with a registered trademark symbol reinforced with the Dolphin MySQL logo.

Additionally phpMyAdmin never really mentions much about the database server you are using. And look it up and phpMyAdmin is often described as the MySQL client.

Am I using MySQL —— NOPE

Open up phpMyAdmin

Open the SQL panel and execute the following query.

SHOW VARIABLES LIKE "%Version%";

So despite all the logos and branding to the contrary I’m using MariaDB for this blog! Useful to know. I don’t know if it was MariaDB when I signed up in 2014 or not but this blog has been running continuously for 7 years and 7 months (at date of publishing this article) with no issues.

Kinsta on the differences between MariaDB and MySQL

I’m happy with being on MariaDB just because I am not mad about Oracle. Turns out I’m not alone in that position. Google / AliBaba and the European Investment Bank are all heavily invested in MariaDB which is probably why so many hosting companies actually run MariaDB in the background. There are big companies on MySQL but MariaDB is not going anywhere and many like me might have been running everything on MariaDB without even knowing it for years!

MariaDB on Wikipedia

I note in the Wiki article they state as a difference between MySQL and MariaDB Geographical Function support – not sure that part is true – I have asked Wikipedia to investigate , according to my research there is support via extensions although I have no personal experience of their use.

Setting up CRON job using cPanel

Automation is so important these days and the following details how to create a simple cron job using CPANEL to send out a regular email. You can automate anything but I was wanting to use an example that would send me something to show that it was working. So I set up the following as an example to send out an email to myself every 5 minutes.

See also
How to Set Up and Run a Cron in CPanel

I am going to focus on a single method. The above link details how to do it using the command line on a linux server which may be helpful. I am concentrating on using the cpanel interface here.

Step 1 : Sign into your cpanel administrative panel.

Step 2 : Look to the Advanced Tab and identify the Cron Jobs Icon

Entering the Cron Jobs panel you will be presented with the following screen.

Leave the Update email button…

Step 3 : Identify the PHP script you wish to run and load it into a directory taking note of where you have noted.
(You will need to point CRON to run your specific script)

If you don’t have a script try this one. It uses the php mail function to send out a simple email to whatever target email you want which allows you to

<?php     
$to_email = 'targetemail@targetcompany.com';
$subject = 'Mail sent using a Cron Job Script';
$message = 'Hello and best wishes';
$headers = 'From: noreply@yourcompany.com';
mail($to_email,$subject,$message,$headers);
?>

Step 4 : Save the above PHP script somewhere and load it to your server so that taking a note of where you put it.

Now I would start and set this to run up every 5 minutes just to test that it is working –

In the common settings there is s drop down which has a range of settings everything from once a minute to once a year select once every 5 minutes.

Step 6 : Set the command to be run.
Now this is the only really tricky part to the whole thing. I haven’t found a great deal of documentation on the syntax of the command that you should enter. I found two different syntaxes that seemed to work.

/usr/local/bin/php /home/youruserid/public_html/cronscripts/testrun.php

or

php -q /home/youruserid/public_html/cronscripts/testrun.php

Then simply hit the Add New Cron Job button and then wait for five minutes – if everything has completed successfully there will an additional line in the cron jobs listing and you will get an email every 5 minutes.

Happy Cron Jobbing.

One interesting point in my cpanel host was that you could limit the cron job to the domain which may be necessary as you become more proficient with the kind of jobs that you are wanting to run in your cron job.