Installing/Reinstalling phpMyAdmin & mySQL

Questions about hosting a Website, using MySQL, PhP or MariaDB may be posted here.
Forum rules
We've moved! Head over to Synology Community (community.synology.com) to meet up with our team and other Synology enthusiasts!
sysadmin21601
Trainee
Trainee
Posts: 11
Joined: Wed Oct 06, 2010 4:56 pm

Installing/Reinstalling phpMyAdmin & mySQL

Unread post by sysadmin21601 » Tue May 21, 2013 2:36 pm

Since there seems to be no instructions on how to do this and most of the "advice" here is for folks clearly more intelligent than I, I thought I'd post my experience in installing/reinstalling phpMyAdmin and mySQL so that, hopefully, newbies like me won't be as frustrated as I have been.

I have a DS1010+ and have loved it more for the software (DSM) than anything. The software package, IMHO, is what sets the Synology line above everything else out there.

However, documentation is sparse and it is assumed that you are an MIT engineering graduate with a doctorate in AstroPhysics. Of course, if you were, you wouldn't need this forum I suppose, BUT....I digress....

I want to set up some test Wordpress sites which requires three elements: web server, mySQL database and phyMyAdmin to administer the mySQL database. I have set up MAMP on my local MacPro, so I know how to do that, but the Synology box is a bit different.

In my case, I had set some of this up months ago and, embarrassingly, forgot what the heck I did. So I figured I'd start fresh. That was a big mistake. So I'll go through initial setup and then how to "fix" things if you screw them up like I did.

---Web Services and mySQL---
You have to turn that on first. You access that in the Control Panel --> Network Services --> Web Services

Check the box to "Enable Web Station" and "Enable MySQL". "Enabling MySQL" turns on the MySQL database and populates it with a "test", "mysql", and "information_schema" databases. If you're anal-retentive like me, you'll probably want to delete one or more of these. I'm guessing (because I don't know for sure) that you could probably delete "test" database since there doesn't appear to be any tables in there. The other two databases have extensive tables, so I'd leave them alone.

If you want to set up more than one installation of WordPress or configure multiple websites, you'll need to configure the "Virtual Host" button under the "Enable Web Station" link. When I configured mine, I made the subfolder name and hostname the same. I'm going to configure my network DNS to accomodate accessing the sites better than <<ip_address>>/<<subfolder_name>>/index.php - but that will be a separate post in another section.

Apache web server is pretty cool (I found out when my Apple XServer) in that all you need to do is some minimal configuration for virtual websites and Apache keeps everything straight when folks attempt to access them.

Enabling Web Station creates a folder at the root of your DiskStation directory called "web". Creating Virtual Hosts creates subfolders inside of the "web" folder. If you are going to have multiple WordPress installations (or just plain ole HTML sites), each subfolder will have to have WP installed in them. You can do that from the Package Center --> Business; but if you do, it will install WP into the root "web" folder. If you are only going to do a single WP installation, that might be OK for you.

In my case, I downloaded the WP package (currently 3.5.1), unpacked it, and copied it to each of my subfolders.

Before you run the WP install, you need to add the database that WP will use to your mySQL database.

---phpMyAdmin---
You can do that through phpMyAdmin from the Package Center --> Utilities. No matter how many installs of WP you have or how many databases, you will only have one install of mySQL and one install of phpMyAdmin.

---Creating mySQL Databases---
Creating a database in mySQL is easy. Start up phpMyAdmin (after it's installed) and click on the "Databases" tab at the top of the page. In the window under "Create database", type in the name of the database and click the "Create" button. You will see the name of the database show up in the Database list. I just named my databases the same as the subfolders I created for my multiple WP installs.

Oh yeah, the default username and password for your mySQL database is "root" and NO password. (That is, a blank password). You need to change that immediately. You can do that in the users tab. I saw three "root" users, so I changed all three passwords to the same password. You can use the password generator to create a very secure password and I would encourage you to do that.

That's really all there is to it. I'm not going to get into installing WP and how to do that; but I will if there is interest, because there are some idiosyncrasies with the Synology box I did not experience with MAMP.

!!IF YOU SCREW UP!!

OK - here's what I wish had been posted so I wouldn't have wasted most of yesterday fiddling and futzing around the forum looking for an answer that wasn't there.

What I did find was how to reset your mySQL password. But I wanted to delete everything and start all over again. I couldn't find my old passwords and couldn't get access to phpMyAdmin.

Basically, you reverse everything you do during the install.

---UNINSTALL phpMyAdmin---
Go to the Package Center - click on Utilities (DSM 4.2) - open PMA - click on the "Action" Button and select Stop, then select Uninstall. (It's possible that selecting "Uninstall" will automatically stop the utility, but I think it's safer to stop it first, then uninstall it.)

---UNINSTALL mySQL---
Now you have to get rid of mySQL. Go to the Control Panel --> Web Applications (tab) and UNCHECK "Enable" MySQL. Click the "Apply" button. You can leave "Enable Web Station" checked and you can leave your Virtual Hosts alone. Clicking the Apply button is necessary in order to, effectively, uninstall mySQL.

---REINSTALL mySQL---
Now you can click on "Enable MySQL" (and click "Apply") which will reinstall the package with a new default username and password.

Maybe this seems intuitive, but I sure as heck didn't think so. I hope this has been helpful.

ludste
I'm New!
I'm New!
Posts: 1
Joined: Wed May 22, 2013 1:55 pm

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by ludste » Wed May 22, 2013 2:17 pm

Hi!

I have had similar problems, and followed your advice, but when I try to reinstall phpMyAdmin, I get the following message:

Image

I have done the following:
  • Uninstall phpMyAdmin
  • Disable mySQL
  • Reset MySQL password and delete MySQL Databases
  • Restart DS
  • Enabled MySQL again
Any advice onn what i should do?
Thanks

sysadmin21601
Trainee
Trainee
Posts: 11
Joined: Wed Oct 06, 2010 4:56 pm

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by sysadmin21601 » Wed May 29, 2013 8:52 pm

I would suggest two things.

First off, after you "Stop" and uninstall phpMyAdmin, go to the directory where it was installed and make sure everything is gone, including the subdirectory before you reinstall.

I also found that restarting the box after I did the reinstall seemed to help.

Try those two and see if that helps.

etastation
I'm New!
I'm New!
Posts: 6
Joined: Sat Jul 06, 2013 3:22 pm

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by etastation » Sat Jul 20, 2013 3:48 am

Hi,
i have the same problem as well. I tried the solution of having a fresh install of the mySQL and phpMyAdmin.

Steps taken:
1. Stop phpMyAdmin services
2. Uninstall phpMyAdmin
3. Uncheck "Enable mySQL"
4. Checked the folder is gone.
5. Restart Box
6. Check "Enable mySQL"
7. Install phpMyAdmin

I still dont have a fresh mysql and phpMyAdmin.
Is there any other solutions that you can give?

etastation
I'm New!
I'm New!
Posts: 6
Joined: Sat Jul 06, 2013 3:22 pm

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by etastation » Sat Jul 20, 2013 4:11 am

:lol:

I have manage to clear this fresh install thing.

Do all the necessary uninstall and unchecking of the mysql.

Last will be to go to Control Panel > System > Restore Defaults

Activate radio button, "Reset MySQL Database Password" and check "Delete MySQL Database"

and your done.

Fresh install.

Be warned, everything will be gone. Make sure you are sure that you want to do a fresh install.

User avatar
amgatx
Student
Student
Posts: 65
Joined: Mon Jan 27, 2014 11:41 pm
Location: Austin, TX

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by amgatx » Thu May 22, 2014 2:04 am

etastation wrote:Activate radio button, "Reset MySQL Database Password" and check "Delete MySQL Database"
With DSM 5, this option does not seem to exist. After attempting to remove and re-install phpMyAdmin (apparently not a wise or advisable decision), something is not configured correctly, and while I can run phpMyAdmin and create new DBs and users, none of this seems to "take effect." When attempting to access a DB for a fresh install, I am consistently presented with this error:

SQLSTATE[HY000] [1045] Access denied for user 'invoices'@'amga' (using password: YES)

I have tried three different softwares including Drupal, and they all return this error. Even after removing and re-installing the package and creating new DB and user info, it always returns this error. I think it's time for bed.


Anyone know where a "delete MySQL Database" option is in DSM 5? A search just points to Web Services, but there are no MySQL settings there. How do I reset only the databases back to factory? :cry:

Jackiemax
Beginner
Beginner
Posts: 27
Joined: Fri Sep 28, 2007 9:31 am

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by Jackiemax » Wed Jul 02, 2014 9:03 pm

Correct me if I'm wrong but I think the mysql DSM function is now replaced by the MariaDB package. You should be able to delete the databases and reset passwords from there.

User avatar
amgatx
Student
Student
Posts: 65
Joined: Mon Jan 27, 2014 11:41 pm
Location: Austin, TX

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by amgatx » Thu Jul 03, 2014 7:17 am

Indeed, Jackiemax, that's what I thought. Unfortunately I was encountering a crazy problem. Somewhere during the uninstallation/reinstallation process, I received two errant lines added into my database. Unfortunately, Synology support is dreadfully lacking when it comes to communicating any relevant information. It feels like pulling teeth (at least 5 days between every single correspondence, literally a month to get this information, even though I reply within 1-6 hours), but I was finally able to receive the following information:

"I received an update from my engineer and it appears the permission settings were incorrect:

MariaDB [(none)]> select Host, User, Password from mysql.user;
+-----------+---------------+-------------------------------------------+
| Host | User | Password |
+-----------+---------------+-------------------------------------------+
| localhost | root | ***************************************** |
| localhost | | |
| amga | | |
| % | amga_invoices | ***************************************** |
| % | amga_blog | ***************************************** |
| % | amga_us | ***************************************** |
+-----------+---------------+-------------------------------------------+

The 2nd and 3rd line shows that any user on this machine can connect without password, and all phpMyAdmin login request fall into this line. This line need no password, so the login will always failed, it has been removed for now and it should work normally now."


So apparently, if I had just tried to access the DB without a password, it would have worked. So that is something to try if you are experiencing a similar problem.

I have had to install manually, because the package keeps installing to the root /web/ directory. Since I am using Virtual Hosts, I have not been able to access it at that location. I still haven't got phpMyAdmin to work correctly.

I have had to move on to other things. Especially because after having Synology "support" log-in to my box, I have been signed up for the worst botnet I have ever encountered. I highly doubt it is a co-incidence. Starting at the exact moment that my DS412+ was logged in to from China (using the default admin account I had to re-enable and the password they had 'no other option' but have me send via unencrypted email), every hour I am getting the most advanced bots creating accounts on every one of my websites. Unfortunately, all the security measures I had enabled, which previously had been essentially 100% successful at blocking all bots, etc., are inadequate. There is simply no way this is a co-incidence. I have been very frustrated by this, as I am getting 100+ fake accounts created each day across every site I administer. I am about to create a thread here specifically for this topic.

However, I mention this here to dissuade anyone from asking Synology for support directly. I have been absolutely let down by them at every turn. My Synology experience was fantastic until it came to actually needing a little assistance. If you are not a million dollar corporate customer, they do not care about you. The amount of time they consume to reply to each and every message you send is clear evidence of this. The internet at large and this forum here are the best places to receive any help. Be VERY CAUTIOUS about letting Synology's "support" department log-in to your box. If they ask you to send your admin password via email, DON'T DO IT! :roll:
Last edited by amgatx on Mon Jul 14, 2014 5:49 am, edited 1 time in total.

User avatar
amgatx
Student
Student
Posts: 65
Joined: Mon Jan 27, 2014 11:41 pm
Location: Austin, TX

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by amgatx » Mon Jul 14, 2014 12:16 am

So after more DB access problems I have finally stumbled across this thread which might reveal the true SOURCE of all my problems. Too bad Synology customer support didn't think to suggest this... the more I read, the more I believe this is the answer:

http://forum.synology.com/enu/viewtopic ... 20&t=83225

this time I am not able to access phpMyAdmin from any host other than 'localhost' ... even the DS's local IP and host name do not work ( #1045 Cannot log in to the MySQL server ... pretty much the identical message my other web apps were returning )


Unfortunately, I had made the mistake of including UPPER CASE characters in my DS's host name. Let this be a lesson to everyone, if you use UPPER CASE characters in your DiskStation's host name, you will have database access problems now that DSM 5 includes MariaDB.

Thank goodness this sounds like a simple problem, but what a PAIN this has been! :roll: I've probably spent more than 100 hours scr-wing around with this! Now this thread is documented for future use by myself and anyone else experiencing this headache.

lower-case letters only people! :mrgreen:

after doing some more searching, it seems leaving the phpMyAdmin server host as 'localhost' should continue to work as long as everything is done on the local machine. But what if I need to run phpMyAdmin from a location NOT on the same machine? It seems like it's just the DiskStation's loopback that is causing the 'localhost' to function. But to me this seems very un-robust and the wrong way to have it set up. I was hoping to manage all mySQL databases (on different servers) from the same phpMyAdmin installation. If I can't make it work with the IP or hostname, this will be impossible. :|

User avatar
amgatx
Student
Student
Posts: 65
Joined: Mon Jan 27, 2014 11:41 pm
Location: Austin, TX

Re: Installing/Reinstalling phpMyAdmin & mySQL

Unread post by amgatx » Mon Jul 14, 2014 5:31 am

amgatx wrote:it seems leaving the phpMyAdmin server host as 'localhost' should continue to work as long as everything is done on the local machine.

alright Murphy, so help me, if I ever run across you out in public... :evil: so I finish configuring phpMyAdmin (again!), test it and it's working well (finally!). So I place the "deny from all" .htaccess file in the /libraries/ directory as instructed in the final sentence here. Reload the app and... blank page. nothing but white. even after immediately deleting the .htaccess file. Tested on my phone and 2 machines. Still, nothing. How the :twisted: does creating and removing an .htaccess do this? Is it just another ridiculous coincidence caused by the capital letters that were once in my hostname? I was so close.... :cry:

Here is my advice: NEVER INSTALL THE SYNOLOGY PHPMYADMIN PACKAGE!!! Install the app manually and sure as :twisted: don't uninstall phpMyAdmin once you have it installed unless you are a freaking ninja. :mrgreen:

However, I do feel fairly certain that it is caused by some combination of having CAPITAL LETTERS in the hostname and then uninstalling/reinstalling phpMyAdmin. Definitely never use capital letters in the hostname; in fact they should just prevent you from being able to do so.

Back to the drawing board. I'm removing all traces of phpMyAdmin and deleting all databases in MariaDB. Once again try to wipe the slate clean (although apparently that's not really possible), and then going back to this guide here and trying it one more time, this time with no other outside influences. Hopefully all the ducks will stay in a row and we'll see what happens. :!: With the section header "Correcting phpMyAdmin error 1045" it will hopefully work now that everything else is in better order, and hopefully the phantom white screen of death doesn't show back up.

Locked

Return to “Web Server + PHP / MySQL + MariaDB”