mySQL, PHP, Apache running on XP - Can't access mySQL Remotely

Posted on 2003-12-09
Last Modified: 2008-03-17
Hi There,

Thanks for stopping by and looking at my problem. I currently run a windows XP box, with Apache, PHP and MySQL. I use this as an intranet in my school and everythign is working fine within the network. However the problem arises when anyone tries to log in from home. We use a program called EasyLink, basically you have to log in to easylink first and then from their you can choose to view your 'My Work' folder or the Intranet. The kids need to view the Intranet from home to get updates on work, download materials etc. Anyway, when anyone tries to access the Intranet remotely the following errors appear:-

'Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in \\intranet-server\intranet\includes\'.

The conncet code is -

$db - mysql_connect("localhost", "root");

I have checked the permissions within mySQL and the user (%) should have access without any problems.

If anyone can help I would greatly appreciate it as my boss is breathing down my neck to get this sorted by the end of term (17th December). If you need me to post any more code or answer any question please ask away.

Thanks in advance for your help on this,
Paul Doherty
Question by:doconline
LVL 17

Expert Comment

ID: 9903891
Ok, some things to check:

Is the server running?
Does the user have the appropriate GRANT permissions?
Are you specifying the correct password?
Have you removed anonymous users from your GRANT tables?

Author Comment

ID: 9904068

Thanks for responding.

The server is running (the system works fine on the local network).
I have set up the account (%) (I think this is all users?) to have the same permissions as administrator for now (I'll get it working before worrying about this).
There is no password for the account.
When you say have I removed anonymous users, is this as point 2 the % user? If so I haven't removed it.

I am using phpmyadmin to admin the mySQL. There is a table 'user' which looks like:-

host       ¦ user ¦ password
localhost¦ root  ¦
%         ¦ root  ¦
localhost¦   %  ¦
%          ¦   %  ¦

All passwords are blank (like I said I'll worry abuot security once it is working properly).

I hope this helps.
LVL 17

Expert Comment

ID: 9904161
I would say you should kill the wildcard users, set a root password, and create a web client user with a password. MySQL password combinations, while predictable, can interact in unexpected ways when you have wildcard users. And a wildcard user is a blank, not a %, you would want to login as user % for that entry.

Author Comment

ID: 9904346
OK, I have removed the (%) user and now have a mysql.user table as follows

host       ¦ user ¦ password
localhost¦ root  ¦ etc
%         ¦ root  ¦ etc
localhost¦   %  ¦ pass
%          ¦   %  ¦ pass

I am still getting the same error as before though. This is sending me square eyed :s
LVL 17

Expert Comment

ID: 9909532
I still see two % users. What are the users connecting through? A web interface?
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Author Comment

ID: 9910627
Sorry my mistake, I meant:-

host       ¦ user ¦ password
localhost¦ root  ¦ etc
%         ¦ root  ¦ etc
localhost¦ webclient  ¦ pass
%          ¦ webclient ¦ pass

The users do come through a web interface I think. We run a program called Easylink. Users log in here first and then through Easylink to the Intranet (they can also access there own share of the network server to access their mywork folder using this program.)
LVL 17

Expert Comment

ID: 9912047
If they connect through a web interface then it really should not matter where they are connecting from, since the client connection to mysql will always be from the web server. I would check again that is specifying the right username and password.

Expert Comment

ID: 9918348
You might also want to consider that your systems might not be correctly mapping the "localhost" address. Sometimes if you enter user root with a blank host, or with host, things suddenly start to work.

See, or better still Google for "MySQL root localhost" and take your pick. There are known pitfalls, which I fell down so long ago I no longer command the details, so Google is your friend. Good luck :-)

Author Comment

ID: 9955677

Thanks for your help on this one. In the end I have had to duplicate the Intranet on the IIS box which Easylink sits on, and run a script to copy over changed database tables and code everyday.


Accepted Solution

modulo earned 0 total points
ID: 12694492
PAQed with points refunded (500)

Community Support Moderator

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Creating and Managing Databases with phpMyAdmin in cPanel.
Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now