persistent phpMyAdmin Problem
Posted by: Crucidal (---.student.utwente.nl)
Date: June 03, 2013 10:56PM

Hi,

So after installing wamp2 and messing around with all kinds of settings (I'm a complete rookie) I finally destroyed my msql server... after googling for 3 hours straight I can't come up with a solution to fix the following situation:

-- Re-installed Wamp.
-- Followed this guide to set up a virtual host: [guides.jlbn.net]

reason: I think it's cool that I have a nice looking url while learning how to build a website tongue sticking out smiley

-- The problem: I can access my webpages when I navigate to /domain/but I cannot access domain/phpmyadmin.

#1130 - Host 'MY_HOST_NAME' is not allowed to connect to this MySQL server

What have I tried so far?
--edit \wamp\alias\phpmyadmin.conf to make it look like this

<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
Allow from 127.0.0.1 ::1
</Directory>

I also tried it without the "::1" and without that last sentence all together. After making changes to this file I restarted the services everytime.

-- edited my.cnf and in cmd I granted all priveleges to root user.

now I did try some other guide 2 but I wasn't prepared to fail so I didn't log everything I did.... at least these are the main things I've tried.

Does anyone has an idea to resolve my problem?
greetings, Chris



Edited 1 time(s). Last edit at 06/03/2013 10:57PM by Crucidal.

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: RiggsFolly (---.as13285.net)
Date: June 03, 2013 11:09PM

Hi Chris,

Ok phpmyadmin runs as an alias ( dont worry what that means ) and should always be run as localhost/phpmyadmin ..... unless you installed it in your virtual host.

So undo your edit of \wamp\alias\phpmyadmin.conf as that will allow anybody anywhere to use your phpmyadmin to lok at your databases. NOT A GOOD IDEA.



-- edited my.cnf and in cmd I granted all priveleges to root user.

root has all privilages by default, so you dont need to do that and the file is called my.ini and lives in \wamp\bin\mysql\mysqlx.y.z. If you have one somewhere else DELETE IT.



here is my HowTO setup Virtual Hosts tutorial, I hope it helps.


HowTo: Create Virtual Hosts in WAMP

BEFORE DOING ANY OF THIS PLEASE ENSURE APACHE AND MYSQL ARE WORKING PROPERLY FIRST!!!

1. Create a new folder outside the wamp directory structure.
for example
C:\websites
but this can be on any disk drive visible to the PC running wamp


2. Create a subfolder in c:\websites for each site you want to create.
for example:
C:\websites\site1
C:\websites\site2


3. Edit the file C:\wamp\bin\apache\apachex.y.z\conf\extra\httpd-vhosts.conf
where x,y and z are the version numbers of apache that you actually have installed.

NOTE: If you are switching between 2 or more versions of apache this will have to be done to all your versions of apache in turn.

SUGGESTION: I like to use the format sitename.dev to make it obvious to me that I am dealing with my localhost development copy of a site, you may prefer another notation, thats ok, the word dev has no actual defined meaning in this case, its just my way of naming my development versions of a live site.

NOTE: Remove ot better still comment out ( using the # in column 1 ) the lines that already exists in this file. They are just examples.

example contents:
	#
	# Use name-based virtual hosting.
	#
	NameVirtualHost *:80

	## must be first so the the wamp menu page loads when you use just localhost as the domain name
	<VirtualHost *:80>
    	DocumentRoot "C:/wamp/www"
    	ServerName localhost
    	ServerAlias localhost
    	<Directory  "C:/wamp/www">
			Order Deny,Allow
    		Deny from all
    		Allow from 127.0.0.1
			# You would never want a remote user to see this wamp config page.
		</Directory>
	</VirtualHost>


	<VirtualHost *:80>
	    DocumentRoot "C:/websites/site1"
	    ServerName site1.dev
	    ServerAlias www.site1.dev
	    Options Indexes FollowSymLinks
	    <Directory "C:/websites/www/site1">
			AllowOverride All
			Order Deny,Allow
			Deny from all
			Allow from 127.0.0.1
		    #If you want to allow access from your internal network
		    # For specific ip addresses add one line per ip address
		    #Allow from 192.168.0.100
	    	# For every ip in the subnet, just use the first 3 numbers of the subnet
	    	#Allow from 192.168.0
	    	# If you want to allow access to everyone
	    	#Allow from all
		</Directory>
	</VirtualHost>

Add as many <VirtualHost> as you require so each of your sites have one, changing the DocumentRoot, ServerName and any other of the parameters as appropriate.
This also allows you to make SITE SPECIFIC changes to the configuration.

NOTE: This will make the wamp manager "Put Online" function no longer have any effect on these new vhost'ed sites as the security for each one is now part of the vhost definition, so leave WAMP, OFFLINE.
If you want to put one or more sites online you will have to change the Allow commands MANUALLY in the httpd-vhosts.conf file.

To check your subnet do the following:
Launch a command window, and run
    >ipconfig
Look for the line "Default Gateway" in the output and use the third number in your Allow commands.


4. Edit your httpd.conf file and search for these lines, they are near the bottom of the file.
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Remove the '#' comment character on this line to Include your newly changed vhosts, this will cause apache to register their existance.
eg
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

6. While still editing your httpd.conf file search for
	#   onlineoffline tag - don't remove
	    Order Deny,Allow
	    Deny from all
	    Allow from 127.0.0.1

	</Directory>
DO NOT CHANGE THESE LINES!

Add the following after the <\Directory> tag to secure your new C:\websites folder.

<Directory "C:/websites/">
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

This is to set security on your new directory structure so that access to these new sites is only allowed from 127.0.0.1 (localhost) unless amended from within a specific VHOST.
P.S. Your internal network will probably be something like 192.168.x.y, check your system first!


7. Now in order for your browser to know how to get to these new domain names i.e. site1.dev and site2.dev, we need to tell windows what IP address they are located on. There is a file called HOSTS that is a hangover from the days before Domain Name Servers (DNS) were invented. It is a way of giving nice easy rememberable names to IP address's, which of course is what DNS Servers do for us all now.

Edit your HOSTS file, this can be found in C:\windows\system32\drivers\etc , the file does not have an extension.
Windows protects this file so you must be an Administrator to be allowed to save changes to this file.

If you are using VISTA or Windows7/8 you may think you are an Administrator BUT YOU ARE NOT!!!!
So to edit this file you must launch your editor, or Notepad in a specific way to gain Administrator rights. To do this find your editors icon and launch it using the following key strokes:
Shift + Right Click over its icon, this will display a menu, click the item "Run as Administrator", and click "Allow" on the challenge dialog that will appear.

Now you are ready to edit the hosts file so navigate your editor to c:\windows\system32\drivers\etc\hosts

Add the following lines to this file

   127.0.0.1   site1.dev
   127.0.0.1   site2.dev
NOTE: You will need to add one line in this file for each of your new virtual hosts.


8. In order for Apache to pick up these changes you must bounce ( stop and restart ) apache.
Do this by: Wamp manager -> Apache -> Service -> Restart Service


You should now be able to use the address site1.dev in your browser to get to your new sites.
Copy your sites code into the "C:/websites/xxxx" folder if you already have a site coded or,
place a quick and simple index.php file into the "c:\websites\xxxx" folder to proove it all works.

example:
   <!DOCTYPE html>
   <html lang="en-US">
   <head>
   <meta charset="UTF-8">
   <title>SITE1</title>
   </head>
   <body>
   <?php
        echo '<div style="background-color:red;color;white;text-align:center;font-size:18px">HELLO FROM Site1</div>';
   ?>
   </body>
   </html>



TROUBLE SHOOTING:
If you have used the new domain name ( site1.dev ) and it has not found the site.
a. Check the changes to the hosts file.
b. Restart the "DNS Service" that runs in windows. This caches all doman names that you use in a browser so that the browser does not have to query a DNS Server each time you re-use a domain name. This may have cached your failed attempt but a restart is easy and should solve the problem and is quicker that re-booting windows, which should also work.
To do this launch a command window as an Administrator ( Shift + Left Click over the command window icon ) and run these 2 commands.

>net stop "DNS Client"
>net start "DNS Client"
Note: The quotes are required as there is a space in the services name.

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: Crucidal (---.student.utwente.nl)
Date: June 04, 2013 12:20AM

Hi RiggsFolly,

First of all: Thank you for the quick and comprehensive response.

So I undid my edit of \wamp\alias\phpmyadmin.conf
After a while I didn't really care whether anybody could join it as long as I would be among those people tongue sticking out smiley

There were no other instances of my.ini so I had to skip that part...

After evaluating your guide (and comparing it to the steps I'd taken in the one previously mentioned) I don't see any difference aside from the fact that you use a different root for offline development.

So I skipped the first 3 steps and continued:

4. Edit your httpd.conf file and ...
--Done

Then I went on to step 6 (There is no step 5 tongue sticking out smiley)

6. While still editing your httpd.conf file search for...

Correct me if I am wrong but I have a map stucture like this:

/wamp/www/domain/
/wamp/www/sub1/
/wamp/www/sub2/

So I think leaving the config file like this should work right?

<Directory "c:/wamp/www/">
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 xxx.x.x.x #(the second one another desktop on the same network)

</Directory>

I left the host files the way I configured them using my static IP (I will get back to that). The reason I do this is because it all used to work and I am not sure whether I'm going to need this when I want to put the server online. (not publicly accessible but at least remotely accessible for me and some friends)

step 8 wasn't a difficult step tongue sticking out smiley

anyway: about that static IP. I don't quite grasp the role of the way my computer is set up in this network but that's why it might be the key (without me knowing it) to solve my problems:

I live at a campus and have no access to a router or w/e. There's just this nice whole in my wall tongue sticking out smiley
So i've got a pc called "Chris-PC" and I requested a hostname for it: "crucidal"
the IP is static (according to the website and I also changed my adapter settings to match it) The default gateway is not 255.255.255.0 does that influence the situation?

anyway I am getting really tired (literally) and I think I messed something up...

current status: I can go to the domain and php pages from my desktop (which is not the server in this case) and from there I cannot access phpmyadmin.
I can't access anything from my laptop (the server) itself anymore (while I could before I posted anything here tongue sticking out smiley)

good night for now.
once again: ty for your response Riggsfolly

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: Crucidal (---.student.utwente.nl)
Date: June 04, 2013 03:25PM

So I semi-solved the problem.

I changed the entries in my host file to

127.0.0.1 localhost
127.0.0.1 domain
127.0.0.1 sub1
127.0.0.1 sub2

(I had used my static IP instead of 127.0.0.1 before)

Now I am still able to access the websites in my www folder but in addition I can also go to
127.0.0.1/phpmyadmin/ and successfully access the databases.

*edit* localhost/phpmyadmin/ is still not working sad smiley */edit*

I keep wondering though whether this is the "right way" to do this... I mean: I can still attempt to go to domain/phpmyadmin and I'd expect to find nothing as I have one php server running... Or at least I assume I do... tongue sticking out smiley However, when I go there I still see: Chris-pc is not allowed to this mysql server...

Does that phpmyadmin and the websites I'll build in domain/ will be on different hosts or something?

greetings chris



Edited 1 time(s). Last edit at 06/04/2013 03:30PM by Crucidal.

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: June 04, 2013 03:44PM

This is going nowhere fast....



Install TeamViewer and I will troubleshoot for you.

Install TV, then run it.

Send me a Private Message containing the TV ID and PASSWORD so I can connect.
Leave TV running as it will change the password each time you restart it.

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: Crucidal (---.student.utwente.nl)
Date: June 04, 2013 03:55PM

Already had tv installed and sent you a pm. However I don't see the pm in my "sent list" therefore I'd like to know whether you received it. If you did I'll notice when you connect. if you didn't receive anything let me know so I can try again.

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: Crucidal (---.student.utwente.nl)
Date: June 04, 2013 07:55PM

Ok,

RiggsFolly went through a lot of trouble and eventually solved the problem for me.

I'm really no expert on this and I can't recall/understand every of the steps he took today...
Basically he did a clean install on my pc and set up everything like he explained in his HOWTO mentioned earlier.

SETTING A PASSWORD:
In case you're having trouble setting a password for the root user. I.e. you set a password, restart the apache server and you get no access check the following:

OPEN CONFIG.INC.PHP
in config.inc.php check that the 'auth_type' is equal to 'config' (that is the file you are currently looking at)
and make sure that the 'user' is set to ' root' and the 'password' is set to the password you used. also set allowNoPassword to false.

IF YOU STILL CANNOT LOG IN (not allowed for ' root' @' localhost')
If you are sure you used the right credentials in the config file. Undo them so that you can log in without a password once again (don't forget to restart the apache server) and make sure that all ' root' accounts get the same password. there should/could be 3 root accounts because there's 3 ways to point to your own computer as a server: localhost 127.0.0.1 and ::1 the latter is used by IPv6

note: If you're unable to set a password for any of these accounts in phpMyAdmin, then download MySQL Workbench (I don't have a howto/explanation on how to do this). Within MySQL Workbench you' re likely to be able to set passwords for the root accounts (at least, we were).

That's as far as my knowledge goes...

This topic can be marked solved and/or be closed.

Riggs, you' re the best smiling smiley

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: bon (175.176.66.---)
Date: July 19, 2020 10:27PM

Hi,

Transferring old wamp files from win7 to my win10 OS

Able to create virtual host as per the new WAMP version.

- be able to set up WAMP successfully
- upload database and working wordpress sources files
- i am able to search and click created website
- display all the webpages perfectly on the browser, but all uploaded images and even newly uploaded images will not be displayedsad smiley

- my site url looks like this -> [my-website-name]
-upon checking uploaded files URL is localhost://my-website-name/wp-content/uploads/....

- how can i revert to localhost name instead of http?

Thank You,
Bon

Options: ReplyQuote
Re: persistent phpMyAdmin Problem
Posted by: Otomatic (Moderator)
Date: July 20, 2020 08:57AM

Hi,

WordPress saves its installation URL in the database.
After transferring a WordPress site, the URL registered in the database must be modified to reflect the new URL.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.