cursed Posted September 7, 2009 Share Posted September 7, 2009 Hello all , Is it possible to access a mySQL database from another website/hosting? Sorry for the noob question. Thanks in advance, cursed Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/ Share on other sites More sharing options...
fotofx Posted September 7, 2009 Share Posted September 7, 2009 Yes as long as the firewall is configured to have the port open (usually 3306) and the user is allowed access. On my system I created a user id specific to the server that is coming in. Say you are calling the mysql server from 192.168.1.75 then on the mysql server you create a user of username@192.168.1.75 and give it permission to access the table it needs access to. Hope this helps Steve Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914287 Share on other sites More sharing options...
cursed Posted September 7, 2009 Author Share Posted September 7, 2009 Hey, Thanks for the reply. I'm not sure how to create a user like user@ip, but heres what I get after replacing localhost with the IP. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'blah_edward'@'66.147.240.179' (using password: YES) in /home7/public_html/ipodtouchmaster/db test.php on line 5 Access denied for user 'blah_edward'@'66.147.240.179' (using password: YES) Do you know if this is an indication of the firewall not being open, and do you know how I can check? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914294 Share on other sites More sharing options...
fotofx Posted September 7, 2009 Share Posted September 7, 2009 Looks like you need to give that user access to the database table. If you are getting that far then the port is open. Steve Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914296 Share on other sites More sharing options...
fotofx Posted September 7, 2009 Share Posted September 7, 2009 Also not a good idea to display your user and IP in this forum.. I would edit your last post to remove the ip or make it generic like I did in the example. Steve Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914299 Share on other sites More sharing options...
cursed Posted September 7, 2009 Author Share Posted September 7, 2009 Thanks again for my newbie questions. That's alright, thats not my real username I use cPanel to create my users, and I'm not sure how to create the user with the IP. The user has appends the cpanel username underscore database user, and truncates after a certain limit - I believe it's 8 letters. Thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914302 Share on other sites More sharing options...
fotofx Posted September 7, 2009 Share Posted September 7, 2009 This should do it (Thanks to Google, I am on a Windows server).. CREATE USER 'new_username'@'localhost' IDENTIFIED BY 'password_for_new_username'; GRANT ALL ON *.* TO 'new_username'@'localhost'; I am not sure about the permissions.. I dont think you need to grant that much access but you should be able to google it and figure it out. Steve Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914316 Share on other sites More sharing options...
fotofx Posted September 7, 2009 Share Posted September 7, 2009 Replace localhost with the IP If you already have the user just set the permissions.. Steve Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-914317 Share on other sites More sharing options...
cursed Posted September 10, 2009 Author Share Posted September 10, 2009 Thanks, really appreciate your help! Quote Link to comment https://forums.phpfreaks.com/topic/173443-solved-accessing-mysql-database-from-another-website/#findComment-915776 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.