| | |
Php mysql connect
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 138
Reputation:
Solved Threads: 0
Hai friends,
I had a main web site and a number of 15 ( also increasing ) child websites. I had a master database in my main website. Now I need to connect main database from the child websites. I had a code to connect the database from main website that is...
I tried this code on child website. But access denied error showing. I already set all privileges to the above user . I tried this code
I also tried www.mydomain.com, http://mydomain.com, ip address of my domain insted of "localhost" . But cant connect...
Please give me a help in the above problem.
Thanks in advance
Rajeesh
I had a main web site and a number of 15 ( also increasing ) child websites. I had a master database in my main website. Now I need to connect main database from the child websites. I had a code to connect the database from main website that is...
mysql_connect("localhost", "user_name","password") or die(mysql_error());
mysql_select_db("database_name") or die(mysql_error());I tried this code on child website. But access denied error showing. I already set all privileges to the above user . I tried this code
mysql_connect("mydomain.com", "user_name","password") or die(mysql_error());
mysql_select_db("database_name") or die(mysql_error());I also tried www.mydomain.com, http://mydomain.com, ip address of my domain insted of "localhost" . But cant connect...
Please give me a help in the above problem.
Thanks in advance
Rajeesh
Do you use shared web hosting?
Most shared hosting limit mysql connection from localhost only due to security reason. You cant connect to mysql on a shared hosting from different host.
Ask your hosting provider whether they provide "Remote MySQL", or move all of your website to one single server.
Most shared hosting limit mysql connection from localhost only due to security reason. You cant connect to mysql on a shared hosting from different host.
Ask your hosting provider whether they provide "Remote MySQL", or move all of your website to one single server.
I'm spammer...
•
•
Join Date: Sep 2008
Posts: 138
Reputation:
Solved Threads: 0
Thanks for your kind advice.
I solved the problem using Remote MySQL, as you said i just added my host name in to remote mysql like XXX.XX.XXX.%.
If you don't mind please let me know for what "%" is using. Is there is any security issue if I enable remote MySQL
Once again thanks for your support
Rajeesh
I solved the problem using Remote MySQL, as you said i just added my host name in to remote mysql like XXX.XX.XXX.%.
If you don't mind please let me know for what "%" is using. Is there is any security issue if I enable remote MySQL
Once again thanks for your support
Rajeesh
•
•
•
•
Do you use shared web hosting?
Most shared hosting limit mysql connection from localhost only due to security reason. You cant connect to mysql on a shared hosting from different host.
Ask your hosting provider whether they provide "Remote MySQL", or move all of your website to one single server.
% mean "from any host"
user1@localhost mean "user1 who came from localhost only"
user1@% mean "user1 who came from anywhere"
disabling remote mysql is the safest option, since you can sure that only script resides on your own server are allowed to access your database.
By enabling remote mysql with wildcard (the %), your database can be accessed (and of course, brute forced) from anywhere.
user1@localhost mean "user1 who came from localhost only"
user1@% mean "user1 who came from anywhere"
disabling remote mysql is the safest option, since you can sure that only script resides on your own server are allowed to access your database.
By enabling remote mysql with wildcard (the %), your database can be accessed (and of course, brute forced) from anywhere.
I'm spammer...
![]() |
Similar Threads
- Looking for PHP / MySQL Developer (Web Development Job Offers)
- Looking for a PHP/MYSQL Programmer (Web Development Job Offers)
- Need Highly Experienced PHP/MySQL Programmer $15-$25/hour (Web Development Job Offers)
- PHP/MySQL Programmer Position (Web Development Job Offers)
Other Threads in the PHP Forum
- Previous Thread: Problem with changing hosting server
- Next Thread: Iframe and virus
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





