How To Connect To Database Server That Isnt On 'localhost'
how to connect to database server that isnt on 'localhost'. are you suppose to replace 'localhost' with the ip address? i keep on getting a 'connect to error. could not find/connect to database'.
View Complete Forum Thread with Replies
Related Forum Messages:
Cannot Connect To MySQL Server Using PHP On Localhost
I have set up MySQL on my home computer, and I am writing a PHP enabled web site to run queries on this database. I have created a database called 'weather' on mysql that I want to access via my website. I have also created a user with a password (this isn't the real one, but I'll use this to illustrate my point) User: carlotam Password: blah Host: localhost To which user I have granted all on database weather. Using a PHP call: I try: $username="carlotam"; $password="blah"; $database="weather"; $host="localhost"; $var = $_POST['topic']; echo "<center><h1>ESCape Database Query</h1></center>"; echo "You have queried <b>$var</b><br><br>"; echo "Your database is: <b>$database</b>.<br>"; echo "Your username is: <b>$username</b>.<br><br>"; mysql_connect($host, $username, $password); @mysql_select_db($database) or die("Unable to select database <b>$database</b> on <b>$host</b>."); mysql_close(); And I keep getting the message "Unable to select database weather on localhost." Is there something wrong with the above, or is there something wrong with my MySQL server configuration? My server is up and running, so I was wondering if anybody can help with this problem? If this information helps: I am running MySQL 5.0.15 server on a PowerMac G4 laptop. And yes, I did check to see if the server was running before I checked the code.
View Replies !
Can't Connect To MySQL Server On 'localhost' (10061)
I recently setup mySQL and PHP on my Windows Small Business Server 2003 Server at my company. I have been wanting to write some php scripts to interact with a database on the server but have been unable to connect to the database via PHP. A simple connect function: mysql_connect("localhost","root","*******"); Yields the error: Can't connect to MySQL server on 'localhost' (10061) The strange thing is, that I was able to connect with phpmyadmin just fine in "config" mode. Where it makes you enter your username and password. Also I can easily connect via the command line on the server through the command mysql -u root -p. I have read that this could possibly be a port issue of some sort. But when I do a phpinfo() on the server it says that the default port is 3306. There is no firewall running on the server. Please let me know if you need any more information.
View Replies !
Installing Cannot Connect To MySQL Server On Localhost?
I'm trying to install MySQL on my server, I go to mysql.com, download the windows version (zip file). Then I click on Setup.exe and it seems to install mysql in the c:/mysql directory, lastly I go to the DOS prompt and navigate to C:>mysql>bin>mysql which should start the service, but I get an error stating I cannot connect to MySQL server on localhost?
View Replies !
Warning: Mysql_connect(): Can't Connect To MySQL Server On 'localhost' (10061)
i was coding a database script in php which uses mysql as backend, am not a newbie to either mysql or php, its been fun for years for me, but during my coding 5 mins before i just got Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) I was not connected to internet so no chance of virus or so, niether any chance of configuration change issue by someone, how can this happen at once? i restarted machine but still the same. I am on a windows server.
View Replies !
Connection With MySQL. Navicat - CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST
I am new in PHP & MYSQL. I installed PHP & MYSQL properly. To easy operate for MYSQL I installed Navicat and it installed properly. But when I am going to test the connection between MYSQL & Navicate the error message showing CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST (10022) it should mention that my connection name = localhost, Ip = localhost,port = 3306 , user name = root in Navicat.
View Replies !
Connect To Database From Another Server
the correct procedure to connect to a mysql database on another host? I have 2 websites on different hosts (servers) and would like to use the records stored on one database on another website. I used $db_host= "www.mywebsite.com" instead of "localhost" and it worked fine for a day now it gives me a 'Lost connection to server' error constantly.
View Replies !
Unable To Connect To Database Server
I am trying to install a PHP script on my server and get the following error message. I replaced username, directory, and folder name for security reasons. --------------------------------------------------------------------------- Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in /bhome/username/directory/directory name/includes/functions/database.php on line 12 Unable to connect to database server! ------------------------------------------------------------------------- Here is the DB Privileges. I subbed the personal data. Code:
View Replies !
Dreamweaver Connect To Database On Remote Server
I'm using DW to connect to a database on my remote host. Connection name: MySQL Server: localhost Username: myusername Password: mypassword Database: It gives me the options to select a database, but I can't quite figure out what I should have for my connection name. Should it be the url of the site, the directory?
View Replies !
How To Connect To Database Which Resides In SSH Protected Server Thru Dreamweaver?!!
I am having problems trying to connect to a mysql database that it itself resides on a SSH protected server... I need to bring it into Dreamweaver 8, so that then I can place and create record-sets, dynamic fields in my pages... so far no luck. I have used databases before with no problems, but never one specifically residing under SSH protected server. I am not sure if I am supposed to be using a tunnel, but supposedly I dont need it in lastest Dreamweaver? Anyways, please, any advise on how to achieve this, please let me know. I do have been able to connect to it thru Navicat's SSH tunnel-settings, and therefore make changes, add/delete fields, etc, but so far havent been able to now bring it into dreamweaver so I can create dynamic pages from it.
View Replies !
Cannot Connect To Localhost Using GoDaddy
I'm (trying) to help a friend setup a MySQL db and use some simple scripts on a site hosted with GoDaddy. I note that GoDaddy appears to use Microsoft. I have done this: $connection = mysql_connect("localhost","mydatabase","password") or die ("Couldn't connect to server."); $sql = mysql_query("SELECT * FROM dummy"); $row = mysql_fetch_array($sql); echo $row['name']; ?> on several Apache servers and it always seems to work. I created the MySQL database using the GoDaddy control panel (which is very confusing and poor IMO). I dove into phpAdmin and was able to do stuff. But I can't get php to connect.
View Replies !
Mysql - Error Warning Cant Connect To Localhost.
simple problem i cant seem to sort out. i can login to mysql account through mydb studio windows program but i try to login through php script // Database Connection $connect = mysql_connect("localhost", "root", "admin") or die(mysql_error()); mysql_select_db("databasename") or die (mysql_error()); i get error warning cant connect to localhost.
View Replies !
How To Connect Remote Site - Can't Connect To MySQL Server
Lets say, i have two php sites named Site-A and Site-B. I want to use MySql Datbase of Site-B for Site-A. Generally i use : $Host="localhost"; $User="username"; $Pass="password"; $DB="databse"; mysql_connect($Host,$User,$Pass); mysql_select_bd($DB); When i connect to Site-B database from Site-A what will be the $Host name? I have tried with: $Host="www.mysite.com"; but it shows the warning: Warning: mysql_connect(): Can't connect to MySQL server on....
View Replies !
Warning: Mail(): Failed To Connect To Mailserver At Localhost Port
I have windows xp pc and i have installed apache as a web server and php also working fine, but when i am sending mail, its giving me following error when upload same to linux live server its working, please help me what do i have to do for this Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:SafrasWebHosting....
View Replies !
Localhost And Server
I am currently developing on a windows XP machine and upload my code via subversion to a linux server. All was great, until I just tried to test out using Zend Studio. if ($_SERVER['REMOTE_ADDR']=="127.0.0.1") { $base_path="../path/"; } else { $base_path="/home/account/public_html/path/"; } Zend studio didn't like 'REMOTE_ADDR' - Undefined index: REMOTE_ADDR, which then meant it couldn't include any files and fell over. I am also having problems using cookies and sessions. if ($_SERVER['REMOTE_ADDR']=="127.0.0.1") { session_set_cookie_params(7200); } else { session_set_cookie_params(7200, '/', '.example.com'); }
View Replies !
Could Not Connect To MySQL: Can't Connect To Local MySQL Server Through Socket
To connect to a MySQL database, hosted on my machine, an iMAC G5 with OS 10.4, I am using the following code: $dbc = mysql_connect ('localhost', 'guestuser', �') OR die ('Could not connect to MySQL: '.mysql_error() ); However, I receive an error message: Could not connect to MySQL: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2). MySQL server is running, and user name/password are valid.
View Replies !
Connect To MySQL - Can't Connect To Local MySQL Server Through Socket
I've finished coding php, run it localhost and uploaded to my Apache server with Linux OS. However, I'm seemingly unable to connect to mysql at the server side. and received the following message: Could not connect to database: Can't connect to local MySQL server through socket '/tmp/mysql.sock'(111) What's this message abt? I tried to get into MySQL without php on the server. and received the same message at the console.
View Replies !
LOCALHOST AND SERVER CONFLICTS
I usually encounter errors on my php pages everytime I upload them on my server. This errors do not appear though while im still coding it in my local machine. How can I avoid the errors (or see these errors while still in my localhost) so that I can save my time and effort and make it bug free before uploading to my server?
View Replies !
Unknown MySQL Server Host 'localhost '
I'm rather new to both MySQL and PHP. I've been trying to use PHP to write to a MySQL database. I call mysql_pconnect to get a database connection, but then when I call mysql_db_select, I get the following error : Unknown MySQL Server Host 'localhost ' I can connect to the database via the command line ok. Where can I look to find the source of this problem?
View Replies !
LOCALHOST Webserver Not Behaving Same As Remote Server
I'm developing a web site, which I test first on my PC (http://localhost/...) and then upload to the web site on the internet when ok. I have a little bit of PHP code (in file download.php) which I use to force the Save dialogue when I want the user to download a PDF file. The hyperlink looks like:- http://localhost/download.php?filename=my_pdf_file.pdf This PHP works *fine* ... on the internet site - but *not* locally!!! On the localhost, instead of prompting to download the PDF file, it prompts to download the PHP file itself! What do I need to do / configure (and HOW and WHERE please) to get this to work locally?? My local web server is Apache 2, and I'm using PHP 4. The PHP code is just:- <?PHP header("Content-type: application/octet-stream"); header("Content-Length: ".filesize($filename)); header("Content-Disposition: attachment; filename=$filename"); $fp = fopen($filename, 'rb'); fpassthru($fp); fclose($fp); ?>
View Replies !
Mail() Problem With Localhost Smtp Server
Using PHP 5.0.4/MySQL 4.1.12/IIS 6. Have setup an Microsoft SMTP virtual server which works fine when I try to send an outgoing email via "localhost" using Outlook. However when trying to use mail(), i get an error "Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini" I had previously tried to use my ISPs smtp server but also got the same "failed to connect" error which is why i tried going locally. Code:
View Replies !
Forms - Scripts Neither Work On Localhost Nor On My Real Server
Iam a complete newbie and am working my way through about 4 books on php basics. It juststarted to get a little interesting with the introduction of forms and getting php to take form submitted information identified by the name attribute to be processed into a variable that would read out via the echo command. Unfortunately it does not work. For some reason php does not want to recognize the name tag and the information contained therin. I have tried several different scripts from various books all designed to do the same type of thing and none of it works. I am wondering if I need to change anything in the php or server settings? These scripts neither work on localhost nor on my real server although other simple php scripts do work, including those were variables are first defined and then read out from within the same php tag.
View Replies !
Why Will Session Variables Work On My Localhost But Not On The Remote 'live' Server?
I have a two page form. I need info from page one to determine the layout of page two. I figure ok I'll use session variables. I built both pages, ran it on my localhost and all works fine. I upload everything to the remote, try it, and page two doesn't respond to session variables. I have as the first line on both pages as session_start(). On page one when data is posted and saved to seeion variables I use the session_write_close() and then header to page two. Why will session variables work on my localhost but not on the remote 'live' server?
View Replies !
Connect To Mail Server
I got this script from a tutorial somewhere, its for conecting to a mail server and reading a list of the messages there. but for some reason it wont work. at all. the page just stays blank. (white). PHP Code:
View Replies !
I Cant Connect To My Apache Server
I installed php-4.3.3, mysql and apache server 2.0.47. but I can not connect to my apache server from my other computer, i use static ip for my server, set ip address for server name on httpd.conf, setup sua server on router. do i miss something here?
View Replies !
Connect To Php3 Server
I'm trying to write a small application that should connect to a pop3 server, and download all mails, but I'm having some small problems. I've checked the php manual, and what I have understood I should use is the imap_open() function? I've tested: $inbox = imap_open("{mail.test.com/pop3:110}", "test", "test") or die("Error"); echo "It Works!!"; But I get an error message that says that the imap_open() function doesn't exist? My phpinfo() says that mod_imap is a loaded Apache module. What am I doing wrong? And how can I fix it?
View Replies !
Can't Connect To SQL Server Via ODBC
I just installed PHP 5.1.4 with SQL Server 2005 on my laptop. PHP is running fine and so is SQL Server 2005. When I try to connect to SQL Server from my my PHP code I get this error. Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:Inetpubwwwrootindex.php on line 5 Here's my connection string that is causing the error $connect_id = odbc_connect("Driver={SQL Server};Server=mydbname;Database=myDB","myUser", "myPass");
View Replies !
Using PHP To Connect To MYSQL Server
I am new to PHP and MYSQL. I recently installed both PHP and MYSQL (the community edition) on my computer and I have been trying to use PHP to connect to and access MYSQL (instead of using the MYSQL command line). I used the mysql_connect() function on a test script but I am getting the following error message when I test the script. Warning: mysql_connect() [function.mysql-connect]: Access denied for user ' '@'localhost' (using password: YES) in filename on line 10. I understand that I am being denied access because I have not submitted the right credentials. However, I am testing this code on my local computer where I have full privileges. What might be the reasons I am getting this message? What are the possible solutions? Do I need to configure mysql such that it recognizes that I am using it on a local computer?
View Replies !
Connect To Apache Server
i need a script that can access files from my machine to another (remote)machine. how do i go abt it. Connect to the Apache server tha's running from a remote computer?
View Replies !
Can't Connect To MySQL Server
I am getting this error, while try to connect to mysql, what might be the problem, I tried to download other version, all are giving me the same error. ERROR 2003: Can't connect to MySQL server on 'localhost' (10061) How can I correct it?
View Replies !
Connect To A MSSQL Server
I am using PHP to connect to a MS-SQL Server. In my SQL statement this snippet of code is giving me error: ... DATEPART(m, Changedate) ... more statements... I looked at online docs -Microsoft, the syntax is correct as far as I could tell, but this is where the SQL errors out... The variable Changedate is a date and time column as: 2003-11-30 00:00:00
View Replies !
Mysql_connect - Can't Connect To The Server
i have installed Apache 2.0.52 + mysql 5.0.16 + php-5.1.0 + phpMyAdmin 2.6.4-pl4 exactly how it is described at but i can't connect to the mysql server. for example this script that i wrote only prints "1" And thats why i think that i can't connect to the server <?php echo "1"; $db = mysql_connect("localhost"); echo "2"; ..... ?>
View Replies !
|