0

I'm fairly new to Wordpress and looking for some help.

Goal: I would like to stream data from my personal computer's Mysql database and display it on a webpage in my offsite Wordpress hosted site. ie. an updated inventory as items are sold.

I am using windows 7 on my personal computer and have already created a user in my database with the appropriate privileges, I also added "%" to allow the connection from any ip. (I understand the security risks, I am just trying to make connection at this time) I am able to connect to my database as this new user locally, and last but not least I have opened firewall and router ports to get this connection working.

My problem is that when I try to connect to my pc from my website ie.

$con = mysql_connect( 'my.ip,xx,xxx', 'user_name', 'password' );
$db =  mysql_select_db( 'database_name' ) or die("cannot connect php3");

I get the cannot connect error displayed on my page.

I should also mention that I am using a plugin called "Allow PHP in posts" which I use for my code.

I have searched the internet to find solutions with no success. I'm guessing there is something special about doing this with wordpress because nothing seems to be working.

Any help would be GREATLY appreciated. If it would be easier to Skype me let me know and we can talk.

Thanks

3
  • 1
    Try codex.wordpress.org/XML-RPC_WordPress_API
    – fuxia
    Apr 24, 2013 at 23:37
  • @toscho's suggestion to use the XML RPC API is certainly the ideal approach, but in troubleshooting the problem as presented, I must ask: have you tried connecting to your local database using a PHP script on your website that is entirely separate from Wordpress? I think it quite unlikely that Wordpress is causing your connection error. Use the mysql_error function to get more specific information. Also note that for security purposes and forward-compatibility, you should use the MySQLi PHP extension rather than MySQL if at all possible.
    – bosco
    Apr 24, 2013 at 23:54
  • I used toscho's link and that is completely foreign to me. I will have to do more research to understand what all of that is. In the mean time, I am also unfamiliar with running programs from the website. I installed a plugin "WP MySQL Console" to run the error check you asked about but it won't connect to anything, not even the local database. When I try to connect to anything I get "Error 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)mysql>" error
    – Matt
    Apr 25, 2013 at 6:43

1 Answer 1

0

If not too late for the answere Since Skype has come to windows ,it will take default ports so local servers can not connect to database Check the ports ,and search for solutions ,if that is the case...

1
  • 1
    MySQL connects on port 3306, this is not what Skype is using.
    – fuxia
    Jul 17, 2013 at 9:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.