MYSQL Error 1042 Cant get hostname

Problems with the Windows version of XAMPP, questions, comments, and anything related.

MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 06. November 2011 12:00

I installed XAMPP Lite USB 1.7.7 on my external hard disk. I go tophpMYAdmin on my laptop with Windows XP and no problem. Then I connect the hd to my desktop running Windows 7 and get error 1042 Can't get hostname for your address. I've googled and many have same problem. The advice is always the same - check the passwords or add skip name resolve. I have trie dboth andit makes no difference. Why should a clean install need any changes not in the install guide. And this advice does not explain why it works on XP not on Win7. I should add that on my Win7 machine.

Cananybody help. I suspect it is a Win7 problem or possibly an antivirus program is interfering. I am computer literate but not an expert.
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby Sharley » 06. November 2011 12:07

When you run the Control Panel can you start Apache and MySQL?

Are there any clues in the \xampp\apache\logs\error.log file?

Can you go to
http://localhost
or
http://127.0.0.1

If so what do you see?

Drag the Windows Hosts file (C:\Windows\system32\drivers\etc\hosts} into your text editor and make sure that the first line after the commented section has this and if not then add it
Code: Select all
127.0.0.1 localhost
Save the file and try again to make connection.


Open \xampp\mysql\bin\my.ini file and find this line and uncomment it (remove the # from in front) so it looks like this
Code: Select all
bind-address="127.0.0.1"
Save the file and restart Apache and MySQL.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 07. November 2011 09:52

I can start apache and MYSQL from the control panel. When I start them I get Windows FirewalI alert but I allow them to have access and they both start. I then go to localhost and get the XAMPP index page. I go to security and all is how it should be with default settings. I go to phpMyAdmin and get the error message.

This is what is in the error log file..........

[Sun Nov 06 00:28:03 2011] [notice] Digest: generating secret for digest authentication ...
[Sun Nov 06 00:28:03 2011] [notice] Digest: done
[Sun Nov 06 00:28:07 2011] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 configured -- resuming normal operations
[Sun Nov 06 00:28:07 2011] [notice] Server built: Sep 10 2011 11:34:11
[Sun Nov 06 00:28:07 2011] [notice] Parent: Created child process 2668
[Sun Nov 06 00:28:12 2011] [notice] Digest: generating secret for digest authentication ...
[Sun Nov 06 00:28:12 2011] [notice] Digest: done
[Sun Nov 06 00:28:13 2011] [notice] Child 2668: Child process is running
[Sun Nov 06 00:28:13 2011] [notice] Child 2668: Acquired the start mutex.
[Sun Nov 06 00:28:13 2011] [notice] Child 2668: Starting 150 worker threads.
[Sun Nov 06 00:28:13 2011] [notice] Child 2668: Starting thread to listen on port 443.
[Sun Nov 06 00:28:13 2011] [notice] Child 2668: Starting thread to listen on port 80.
[Mon Nov 07 15:45:50 2011] [warn] pid file F:/XAMPP/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Nov 07 15:45:50 2011] [notice] Digest: generating secret for digest authentication ...
[Mon Nov 07 15:45:50 2011] [notice] Digest: done
[Mon Nov 07 15:45:51 2011] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 configured -- resuming normal operations
[Mon Nov 07 15:45:51 2011] [notice] Server built: Sep 10 2011 11:34:11
[Mon Nov 07 15:45:51 2011] [notice] Parent: Created child process 3884
[Mon Nov 07 15:45:51 2011] [notice] Digest: generating secret for digest authentication ...
[Mon Nov 07 15:45:51 2011] [notice] Digest: done
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Child process is running
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Acquired the start mutex.
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Starting 150 worker threads.
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Starting thread to listen on port 443.
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Starting thread to listen on port 80.
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Starting thread to listen on port 443.
[Mon Nov 07 15:45:52 2011] [notice] Child 3884: Starting thread to listen on port 80.

This is the hosts file.....................

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

127.0.0.1 genuine.microsoft.com
127.0.0.1 mpa.one.microsoft.com
127.0.0.1 sls.microsoft.com

127.0.0.1 localhost
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 07. November 2011 10:16

i edited the files...... now my.ini is...........

# The MySQL server
[mysqld]
port= 3306
socket= "/XAMPP/mysql/mysql.sock"
basedir="/XAMPP/mysql"
tmpdir="/XAMPP/tmp"
datadir="/XAMPP/mysql/data"
pid_file="mysql.pid"
skip-external-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error="mysql_error.log"
bind-address="127.0.0.1"

And hosts is...............

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

127.0.0.1 localhost
127.0.0.1 genuine.microsoft.com
127.0.0.1 mpa.one.microsoft.com
127.0.0.1 sls.microsoft.com

BUT same problem as before.
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby Sharley » 07. November 2011 10:37

OK, they now look good.

Open \xampp\phpMyAdmin\config.inc.php and edit this line so it looks like this
Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'http';
Or change to 'cookie' if you prefer.
There are no other settings that need changing in this file.
Save the file and restart MySQL, then try http://localhost/phpmyadmin again.

You may also need to clear your browser's cache (Temporary Internet Files etc.) so you are getting a fresh page from the server and not one from the cache.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 07. November 2011 11:27

I did the edit so now looks like this...............

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

I stopped and exited control panel then returned to myphpadmin. This time I got a pop up fopr login and pass. I entered root and no pass. Then I got to same error message but a different screen. Thats to same it was same error 1042 but the title bar in red not orange and without explanation.

I shut down appache and mysql then restarted and returned but the time I was taken straight to the error page even though the time before I did not check the "remember me" box.

PS - many thanks for your help. Much appreciated and lack of local server is causing me problems with work.

Perhaps I should give background. Before I installed it easily. I was working with it for a month then one day got the error for no reason. I removed, reinstalled, tried installer and lite. Cleaned registry and everything but still the error. Then laterI bought new pc with win7 and tried again but still same error. I did install AVG and Avast antivirus - (later removed) on old and new pc. I dont know if affecting it but I mention it just in case.
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby Sharley » 07. November 2011 11:38

Do you have ZoneAlarm?

Did you use the installer exe version of XAMPP when installing to your removable storage device?

If so then remove that version and download the zip or 7zip version and extract it to your removable device and again try the process of having it work on the laptop then try it in your Win 7 again and see if you get the same error, I hope not. :)

I downloaded the 7zip and extracted it to a hard drive on my PC and it worked fine - remember not to run the setup_xampp.bat file.

The installer used in XAMPP has been know to produce some strange results and will be changed in the next XAMPP version release in 2012.

Fingers crossed. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 11. November 2011 08:05

I have now...............

1. deleted all previous xampp files and folders (as well as other similar programs).
2. run ccleaner registry cleaner and removed registry entries for xampp as service
3. unpacked xampp lite win32 USB 1.7.7
4. left the change to host file intact (as per your previous post)
5.started apache and mysql from control panel
6. got to xampp index page on localhost
7. click on the phpmyadmin menu link .. and got the same error message
8. tried on avant browser and IE - same result
9. looked in error log and nothing untoward there.
10. Made the edit to config inc - stopped apache and mysql then restarted and same error.
11. Ran HeidiSQL and got the same error - cant get hostname for your address

I am at a loss what to do now. What next?
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby hackattack142 » 11. November 2011 18:03

It sounds like something is interfering with your reverse DNS lookups.

Have you tried connecting with an IP address (eg. 127.0.0.1)?

You could do this by doing http://127.0.0.1/phpmyadmin

If you get the same error page, make sure to hit the refresh button in your browser so it is not using a cached version of the page

If that does not work, you could try opening your phpMyAdmin configuration file (/xampp/phpmyadmin/config.inc.php) and adding this line under the 'AllowNoPassword' line:
Code: Select all
$cfg['Servers'][$i]['host'] = '127.0.0.1';

Be sure to specifically refresh your page again too if you get the error page.
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 11. November 2011 18:15

Yes I tried that - same thing. I tried skip name resolve and that not work. I think it may be a Win7 compatibility issue. I dont know but xampp works on my XP laptop and not local server MySQL works on my Win7 desktop. MS are constantly doing new buillds, patches, fixes and it may be something there. I plan to check on another win7 machine. But whatever it is I cannot be the only person in the world it affects. There is nothing weird about my machine, especally since it is new with little software (as yet) installed.

Thank you for your help by the way and the reason I am perservering is because having compared similar local servers xampp is the best in my view.
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby hackattack142 » 11. November 2011 18:24

I use XAMPP on Windows 7 Ultimate SP1 64-bit, Windows 7 Enterprise SP1 64-bit, and Windows XP SP3 32-bit without problems. There are numerous others that use Windows 7 without problems.

Have you recently installed any security software that might interfere (Antivirus, Firewall, IPS, Antispyware, Antimalware)?

Have you tried disconnecting from the internet and temporarily turning off Windows Firewall or other software that might interfere?
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 14. November 2011 19:01

I have a new pc with fresh win7 32 bit install.. and xampp myphpadmin did not work. I later installed and removed avast and avg. I have ms essentials installed. I appreciate it works for you and many others but that does not change the fact it is not working for me.

It workd on my xp laptop so I am sure the problem is not my xampp copy. It may therefore be a conflict or something interfering with it. I was hoping somebody may know what causes conflict rather than trial and error. The question is therefore .. what other software may interfere and produce that error message.

Windows firewall has it listed as an exception and allows communications.
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby Sharley » 14. November 2011 23:05

If someone had an exact copy of your PC then they would be able to give you some pointers as to a solution - all computers are not the same so some trial and error solutions are offered in good faith by those in here with a strong knowledge of both XAMPP and various operating systems.

Also remember that we don't have access to your computer so we rely strongly on the details you provide to help find a solution, trial and error or not. :).


Perhaps the problem lies in the method used to install XAMPP if you used the Installer exe version as it has some OS related issues and is to be replaced in the next release.

I suggest you uninstall then install using the zip or 7zip archive version outlined in these instructions:
viewtopic.php?p=179699#p179699

If you follow the above and you finally get it to work, as it has for so many, then it may well point to the buggy installer exe version.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MYSQL Error 1042 Cant get hostname

Postby MacGuffin » 15. November 2011 07:19

I appreciate no two systems are exactly the same but did not know that made a difference. Software has system requirements and operating conditions. If it "runs on all platforms" then it should. If there is a known conflict with anti-virus programs then it should be noted. I was hoping that with all the users and years since release this problem had come up before and the solution known.

Its like going to the doctor, no two human bodies are the same but normally he knows the cure based on other patients, experience, knowledge of systems, interactions and conflicts. It would seem that my problem is not a common cold but some rare disorder unknown to medical science.

Thank you for trying to help.

PS - My previous post explained what xampp version I am using.
MacGuffin
 
Posts: 10
Joined: 06. November 2011 11:49
Operating System: Windows 7

Re: MYSQL Error 1042 Cant get hostname

Postby Sharley » 15. November 2011 07:40

The reason we ask for your OS version and the XAMPP version is because we have found that the best support we can offer is now version related.

XAMPP 1.7.5> versions have been compiled with VC9 2008 and so they are different to earlier version (VC6) and are very much Windows version reliant that the correct runtime files are present, among other strange anomalies that this forum is seeing on a daily basis.

XAMPP is a suit of components ported from Linux, not a single piece of software, so each individual component needs to be tuned to each and every version of Windows by the use of configuration files.

If you do an Internet search for your exact MySQL error 1042 message then you will see that there is no definitive solution even from MySQL Dev and it is not limited to only Windows computers but also to any OS that MySQL will run on.

On these forums we do manage to solve 99% of support request in both English and German language forums and in other operating systems, that's our record of success over the many years the XAMPP suit of components has been released and the millions of successful installations.


So your next step is to try and tune the individual component's configuration files to suit your particular computer.

The help already provided here, no matter how inadequate, was based on the details you have provided and on previous solved issues, so if you omitted some details then perhaps the help offered was not relevant.

I can't see that there is any more help that can be offered except to say that the XAMPP Lite version is just that and perhaps you may like to try the full version to see if that works for you, and if it does then obviously the lite version is not for you (the full version zip or 7zip unpacks to removable media as long as you don't run the setup_xampp.bat file - IZArc is not recommended to unpack 7zip files: viewtopic.php?f=16&t=48955).

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests