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?
 
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
 
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 solve my own problem.

The solution is posted with an explantion of how I arrived at that solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.