0

How to connect mysql with difference server
If my all file is in 192.168.0.100 and mysql server is 192.168.0.200
I got Error "sorry, could not load your data, please try again later" when try it.
If bote all file and database is in same server , It run correct.

<?php
class DBConnection{
     function getConnection(){
     //localhost/amarokuser/amarokpasswd
         mysql_connect("192.168.0.200","root","") OR
     die("Could not connect: " . mysql_error());
   //amarokdb
         mysql_select_db("jqcalendar") OR
             die("Could not select database: " . mysql_error());
      }
}
?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

4
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by legi0nare
0

You need to add a user to mysql for outside access and give it privledges to access the database jqcalendar. I would suggest using a different user than root and only giving access to the database you need to update. In your case I suggest the user name should be something like:
jqcaldb@192.168.0.100

But it can be any name you want as long as the ipaddress you are coming from is included.

0

@smantscheff : I'm sorry. I Just did example for user root.
@rch1231 : I had do that already. But it error "sorry, could not load your data, please try again later"
For this qcaldb@192.168.0.100 it cannot run correct for jqcalendar's table but other table i can got it in same user

Example table "user" i used user "qcaldb" and run php script from 192.168.0.100 connect to mysql 192.168.0.200 i can got user data all and when i used phpMyAdmin with same user to access to table jqcalendar from 192.168.0.100 result no problem
but when run wdCalender Script page (sample.php) i got error. also no problem when apache and mysql is in same server. What did i missing.
......
I forgot it ... When I use Desktop PC with Windows XP and use apache with servername localhost and IP 192.168.0.50 and connect to mysql server 192.168.0.200 it run correct too.
But if use Web server 192.168.0.100 connect to 192.168.0.200 it error
with my user is admin@% (Mean allow all) That Right?


Sorry for my bad Endlish.

Edited by neopalm: n/a

0

@smantscheff : I'm sorry. I Just did example for user root.
@rch1231 : I had do that already. But it error "sorry, could not load your data, please try again later"
For this qcaldb@192.168.0.100 it cannot run correct for jqcalendar's table but other table i can got it in same user

Example table "user" i used user "qcaldb" and run php script from 192.168.0.100 connect to mysql 192.168.0.200 i can got user data all and when i used phpMyAdmin with same user to access to table jqcalendar from 192.168.0.100 result no problem
but when run wdCalender Script page (sample.php) i got error. also no problem when apache and mysql is in same server. What did i missing.
......
I forgot it ... When I use Desktop PC with Windows XP and use apache with servername localhost and IP 192.168.0.50 and connect to mysql server 192.168.0.200 it run correct too.
But if use Web server 192.168.0.100 connect to 192.168.0.200 it error
with my user is admin@% (Mean allow all) That Right?


Sorry for my bad Endlish.

More in formation
About grant user i have to do this
grant all privileges on *.* to admin@'%';
flush privileges;

0

sorry, could not load your data, please try again later

This is not a mysql error message. Where does it come from?
Can you connect to 192.168.0.200 from a mysql client at your workstation with the given username? And didn't you forget the password?

0

Are all of the servers in the same subnet and local to each other? If you have phpmyadmin then lyou should be able to look at the users table and see what users have privledges to what tables. double check your settings and do a tracert just to make sure you are following the path between servers y0ou think you are.

1

First i throught that about mysql connect with difference server problem but i can connect with command mysql -u -p and i can use phpMyAdmin to connect to it with client webserver.

also
I can solve it already. I put this script to get about ajax error.

$(document).ajaxError(function(e, xhr, settings, exception) { 
	alert('error in: ' + settings.url + ' \n'+'error:\n' + xhr.responseText ); 
});

It is a problem with json_encode() function in datafeed.php (wdCalendar)
That will be include in PHP5.2 up. Then I try to update my php to PHP5.3 ,It solve a problem.
After that if PHP is version 5.3 . I got new error about date_default_timezone_set

date_default_timezone_set('Asia/Bangkok');

I fix it with this in my timezone. I put it in dbconfig.php (wdCalendar)

Thank you all for every help. ู^^

Edited by neopalm: n/a

0

First i throught that about mysql connect with difference server problem but i can connect with command mysql -u -p and i can use phpMyAdmin to connect to it with client webserver.

also
I can solve it already. I put this script to get about ajax error.

$(document).ajaxError(function(e, xhr, settings, exception) { 
	alert('error in: ' + settings.url + ' \n'+'error:\n' + xhr.responseText ); 
});

It is a problem with json_encode() function in datafeed.php (wdCalendar)
That will be include in PHP5.2 up. Then I try to update my php to PHP5.3 ,It solve a problem.
After that if PHP is version 5.3 . I got new error about date_default_timezone_set

date_default_timezone_set('Asia/Bangkok');

I fix it with this in my timezone. I put it in dbconfig.php (wdCalendar)

Thank you all for every help. ู^^

Hello neopalm, even after upgrading from php 5.2 to php 5.3 , the error persist, Can you give me any other suggestions for this ?

And one more thing is i am able to add the details to the database but only the month view is not showing up.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.