Error establishing database connection using XAMPP on web server

Hello experts,

I recently installed xampp on our webserver.

I tried to load wordpress using http://localhost/mysite/

The page came up just fine.

However, we would like our users to be able to view the wordpress site from their own PCs. That's why we loaded xampp on the server instead of on local PC.

So when I changed the url from localhost to servername (http://servername/mysite/, I get Error establishing database connection.

Everything looks good including servername.

Any ideas what I am doing wrong?

Thanks in advance
LVL 29
sammySeltzerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ares KurkluSoftware EngineerCommented:
If it is giving 'database connection' error, username or password must be wrong but saying that you should have the same error message in both instances giving they are pointing to the same place i assume you did http://localhost/mysite/ when you were in the server?
0
sammySeltzerAuthor Commented:
I have resolved the problem.

The issue is that given that I created the account for a user with localhost access, it could not recognize from another PC.

To solve that problem, I had to grant same user access to both localhost and to any host represented with an asterik.

CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'localhost'
  WITH GRANT OPTION;
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'
  WITH GRANT OPTION;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sammySeltzerAuthor Commented:
I solve my own problem.

The solution is posted with an explantion of how I arrived at that solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.