0

I tried to connect to my DB server using the hostname and the port in the file config.php but still give me error, I won't use the localhost server, the database is in other server. I get the hostname using : show variables like '%hostname%' and get the port using : SHOW VARIABLES WHERE Variable_name = 'port'

define('DB_USER', "test"); 
define('DB_PASSWORD', "test"); 
define('DB_DATABASE', "test"); 
define('DB_SERVER', "My problem is here"); 

someone know what I did wrong?

thank you

5
  • i dont understand. if you can do what sql you post, you are logined into server. Commented Nov 7, 2013 at 16:42
  • What are you trying to do exactly? Commented Nov 7, 2013 at 16:45
  • yes I am logined using the interface of the server but when I try to access to data using php I get failed Commented Nov 7, 2013 at 16:45
  • what interface? mysql cli client ? Commented Nov 7, 2013 at 17:02
  • i know whats wrong with you. you open mysql cli, and run netstat -ntp | grep <PORT YOU GET> to find the server ip Commented Nov 7, 2013 at 17:07

1 Answer 1

1

Some hosts, you can't connect to their database from your localhost, but only from their webserver.

Maybe thats your problem ?

Sign up to request clarification or add additional context in comments.

1 Comment

yes Mr Rasmus exactly, so I think I have to megrate my code to the server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.