Tuesday 9 May 2017

Configuring PhpMyAdmin to Connect to MariaDB

Assuming that you have a webserver, a running PhpMyAdmin connected to a locally installed MySQL and a newly installed MariaDB in your local server, we can easily set MariaDB as the default database server for PhpMyAdmin. Aside from that assumption, what we're also guessing here is that you have the necessary rights to access the virtual directory or the webroot of your local webserver where your copy of PhpMyAdmin folder is installed.

Anyway, here’s how I did it.

1. In the PHPMYADMIN folder, copy the file config.sample.inc.php to a new file config.inc.php.
2. Open the file config.inc.php in any text editor. Look for the following lines:

/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;

3. Notice that the default value for the “host” field is localhost.  By right, as I’ve said in the beginning, PhpMyAdmin referring to localhost as its server for database will connect to MySQL. And by some standards, the port rightfully assigned to MySQL Server is port 3306. For MariaDB, I set it to use the port 3308, so what we’re gonna do is attach that port number to the string needed by the host field so PhpMyAdmin should connect to MariaDB instead.

/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost:3308';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;

4. Leave the tcp as the standard connection type.


Here’s what PhpMyAdmin connected to MariaDB should somehow look like in your end. Now, the real question is, why the need to use PhpMyAdmin when one can be better off with some desktop SQL Managers like HeidiSQL?

The whole point of doing this is not to replace your current SQL Manager with PhpMyAdmin but to augment it. What I mean by that is, it's almost not possible to be at your own desk all the time. Sometimes, you’ll have to work on another computer in your company. What PhpMyAdmin can do is to let you access your database in the browser in any computer in your local network and do your thing right there especially in times of urgency. Otherwise, you’ll just have to walk back to your desk and use HeidiSQL that is installed in your office PC.

That’s all for this post. Have a nice day everyone!

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...