phpMyAdmin SQL Database storage location?

I’ve just been playing with my MyCloud Mirror and my Raspberry Pi (running Kodi via Openelec 5.0.8) to set up the media library on the MCM using a MySQL database set up via phpMyAdmin. It’s all working fine (after a bit of tweaking and prodding), but it has raised one small question.

Does anyone happen to know where phpMyAdmin will be storing the MySQL database on the MCM? I was expecting something to probably show up in the public share (like the Dropbox app does for its storage) but there’s nothing in there relating to phpMyAdmin.

So my question is does anyone happen to know where on the drives (my MCM is set in JBOD mode) the databases are housed? I know it’s a 3rd party app and not officially supported, but just wondering if anyone else can fill in the knowledge-gap?

I presume it’s somewhere in the guts of the file system somewhere which can only be accessed via SSH rather than visible in a share? But I’d like to keep a backup of it, and not have to use SSH to access it to do that…

DarrenHill,

I have an EX2 not a Mirror, but I believe this location will be the same, esp. since I use my EX2 in JBOD mode too.

The thing is I never installed phpMyAdmin and I’ll talk about that in a second, but the MySQL data is usually stored here →  /mnt/HD_a4/.@database@/mysql

If you want to back up the db, I would grab the whole .@database folder (note the period before @) - but you might be best served by doing adb export rather than backing up files like this.

Which brings me to my point about phpMyAdmin. To backup the db, I suspect you can probably use myPHPAdmin to do an export of the whole db - BUT I would recommend you to not use that tool at all, especially if you have outside access enabled over port 80 (I do). Ever since I enabled logging on port 80 last year, I noticed there are multiple probes everyday by people trying to exploit vulnerabilities in myPHPAdmin’s scripts. And I do mean EVERYDAY. I can open any random day’s http logs and will always see a dozen or more attempts that look like this (taken from today’s logs):

199.33.126.82 /phph/php/ph.php [29/Apr/2015:07:18:04 -0400] "-" "-"
199.33.126.82 /phpMyAdmin/scripts/setup.php [29/Apr/2015:07:18:04 -0400] "-" "-"
199.33.126.82 /pma/scripts/setup.php [29/Apr/2015:07:18:05 -0400] "-" "-"
199.33.126.82 /myadmin/scripts/setup.php [29/Apr/2015:07:18:05 -0400] "-" "-"
114.38.253.141 /phph/php/ph.php [29/Apr/2015:09:59:58 -0400] "-" "-"
114.38.253.141 /phpMyAdmin/scripts/setup.php [29/Apr/2015:09:59:58 -0400] "-" "-"
114.38.253.141 /pma/scripts/setup.php [29/Apr/2015:09:59:59 -0400] "-" "-"
114.38.253.141 /myadmin/scripts/setup.php [29/Apr/2015:09:59:59 -0400] "-" "-"
110.78.141.147 /phpMyAdmin/scripts/setup.php [29/Apr/2015:11:52:44 -0400] "-" "-"
110.78.141.147 /pma/scripts/setup.php [29/Apr/2015:11:52:45 -0400] "-" "-"
110.78.141.147 /myadmin/scripts/setup.php [29/Apr/2015:11:52:46 -0400] "-" "-"
222.218.142.137 /phph/php/ph.php [29/Apr/2015:14:46:11 -0400] "-" "-"
222.218.142.137 /phpMyAdmin/scripts/setup.php [29/Apr/2015:14:46:11 -0400] "-" "-"
222.218.142.137 /pma/scripts/setup.php [29/Apr/2015:14:46:12 -0400] "-" "-"
222.218.142.137 /myadmin/scripts/setup.php [29/Apr/2015:14:46:12 -0400] "-" "-"
203.195.151.25 /phph/php/ph.php [29/Apr/2015:16:29:33 -0400] "-" "-"
203.195.151.25 /phpMyAdmin/scripts/setup.php [29/Apr/2015:16:29:35 -0400] "-" "-"
203.195.151.25 /pma/scripts/setup.php [29/Apr/2015:16:29:35 -0400] "-" "-"
203.195.151.25 /myadmin/scripts/setup.php [29/Apr/2015:16:29:36 -0400] "-" "-"
83.212.117.120 /phph/php/ph.php [29/Apr/2015:18:19:29 -0400] "-" "-"
83.212.117.120 /phpMyAdmin/scripts/setup.php [29/Apr/2015:18:19:29 -0400] "-" "-"
83.212.117.120 /pma/scripts/setup.php [29/Apr/2015:18:19:30 -0400] "-" "-"
83.212.117.120 /myadmin/scripts/setup.php [29/Apr/2015:18:19:30 -0400] "-" "-"

If you don’t install myPHPAdmin app, those scripts won’t be there in the first place. I would instead advise you to use the MySQL Workbench tool, a free tool available from MySQL folks. Last August, I had documented how to use it with EX2 here →   http://community.wd.com/t5/WD-My-Cloud-EX2/Enabling-logging-for-lighttpd-web-server/m-p/788667#M1197

Skip most of the text, which are now deprecated and jump to the paragraph right above the screenshot of MySQL Workbench’s login screen. It connects to the MySQL database via an SSH connection (read that paragraph and the screenshot for login steps).

If this info helps, please click on the star under my username to give me a kudo.

1 Like

Thanks - some interesting points there. I presume the MySQL Workbench is installed on a machine on your network rather than the NAS itself? It’s not quite clear from the post and link.

Also if I uninstall phpMyAdmin, I’m now wondering if it will nuke the SQL username and databases as well. I had to do the set-up twice (with an uninstall and reinstall in the middle) and the settings seemed to persist across the installs. So as I’m probably not going to be doing much by way of database tweaking anyway, another option now things are set up is perhaps to just uninstall phpMyAdmin anyway and only reinstall it (or use the MySQL Workbench) if I do need to make any interventions in the database. But as that is set up and populated by Kodi on the Pi anyway (all I needed phpMyAdmin for was to set up the user and grant them access) now that’s done it could be superfluous to requirements.

My situation is a little different to yours, as I don’t have remote access enabled on my MCM (neither remote dashboard access nor cloud access for the files themselves) so things are a little more locked-down than in your case. If I want to access from off my network, I instead have a remote connection set up on my netbook on the network (via Google Remote Desktop or Splashtop), and then I use that as a jump-off point to internally access the MCM in the usual way inside my network.

So aside from that there should be no vector for anyone coming in from outside to port-scan the MCM or gain access to anything unless they somehow manage to break into my network via either the netbook or the router itself, at which point of course all bets are off anyway.

OK, good advice (as ever).

phpMyAdmin is now off the MCM, and MySQL Workbench is on my netbook and can see the database fine (and more importantly so can the Pi). The database is stored in /mnt/HD_a4/.@database@/ as you said, so everything is answered and fine.

As the Pi is updating and sorting out the database quite happily, I’m not even sure I’m going to need the workbench unless something breaks, so will be the best of both worlds as I can keep SSH off too unless I need to make the connection.

Anyway can call this one sorted nicely I think :slight_smile:

Glad it worked out for you :slight_smile:

And you are right - in your case I do not see any vector to your network. Port scans will happen to you as well but they won’t get anywhere. The log I posted were direct attempts (from those listed IPs) to trigger a myPHPAdmin setup over the web and thereby hijack the machine…which all fail in my case because I never installed it in the first place. But despite you not having any vector to your network like that, good to hear you decided to remove it anyway. I am certainly intrigued by your use of a Pi device. Another recent poster on EX2 sub-forum is also using a Pi device to d things with his EX2. I am certainly intrigued and would toy with one, but I am ltely toying with Red Hat Enterprise Linux after using Oracle Linux for past few years…running both as a VM.

Anyway, thanks for the followup update. Always is satisfying to know how the other person I tried to help made out…often times people come here with a fly-by-night question and after you offer an answer they disappear after reading the answer and not saying anything (of course, you have been actively involved in this community for a while like me offering help to others - and I am sure we’ve even interacted on some other thread…am always glad to be of use to folks like you who take the time to relay the results of my advice).

:slight_smile:

The Pi is connected to my TV as a media player (Kodi 14 via OpenElec 5.0.8), playing filns from the MCM (or strictly from a WD Elements 5TB connected to it) via NFS, so I thought I may as well host the SQL library database that it uses to store the media information (both metadata and also the watched/not watched and progress information) on the MCM too. I also have Kodi on my laptop referencing the same database now, so i can do things like stop a movie part-way on the TV and then resume playing it on the laptop from the same place. Plus if the SD card in the Pi corrupts or has other issues then the database is safe.

And I know what you mean about the satisfaction factor from the helper side too. The kudos I gave you above has (currently) put us equal in the all time count for this section (although I know you’re far ahead of me overall, and deservedly so). I think you helped me in the first issue I had with the MCM that brought me here originally, and it’s been nice to help others out too.