473,748 Members | 6,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connecting to db..

this seems pretty straight-forward.. got this code

$link = mysql_connect(' localhost:3306' , '<uid>', '<pswd>');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($li nk);

from here..
http://us2.php.net/function.mysql-connect

but can't connect, get this error:

Connect to db:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
MySQL server on 'localhost' (10061) in
C:\xampp\xampp\ htdocs\home\con n.php on line 19
Could not connect: Can't connect to MySQL server on 'localhost' (10061)

I connect to this same MySQL server from Tomcat w/no problem.. what is
issue here pls...
now on top of pg mentioned above, there this description:

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link [, int client_flags]]]]] )

what does 'resource' refer to here pls... and where to do specify what
db to connect to... (in java you put db-name in same line where you
make the connection..)
(and don't you need a driver to connect, I use a JDBC driver to
connect w/Java..)

would very much appreciate some help.. thank you...

Frances

Jun 6 '06 #1
7 4059

disregard -- now all of a sudden can't connect from Java either.. I
don't get this.. I've been connecting successfully to db for over a
year from both Tomcat & java stand-alone classes, now all of a sudden am
trying to connect also from PHP and I can't connect at all..

when try to connect just from console get error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

what is this.. what is 10061.. :(

is it really not possible then to connect to one MySQL server from diff
web servers? (I don't think so..) I want to set up my machine so can
connect to same MySQL server from Tomcat, IIS, PHP.. (the port thing is
also a big pain and don't know if will be able to pull this off..) thank
you very much..

Frances

Frances wrote:
this seems pretty straight-forward.. got this code

$link = mysql_connect(' localhost:3306' , '<uid>', '<pswd>');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($li nk);

from here..
http://us2.php.net/function.mysql-connect

but can't connect, get this error:

Connect to db:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to
MySQL server on 'localhost' (10061) in
C:\xampp\xampp\ htdocs\home\con n.php on line 19
Could not connect: Can't connect to MySQL server on 'localhost' (10061)

I connect to this same MySQL server from Tomcat w/no problem.. what is
issue here pls...
now on top of pg mentioned above, there this description:

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link [, int client_flags]]]]] )

what does 'resource' refer to here pls... and where to do specify what
db to connect to... (in java you put db-name in same line where you
make the connection..)
(and don't you need a driver to connect, I use a JDBC driver to
connect w/Java..)

would very much appreciate some help.. thank you...

Frances

Jun 6 '06 #2
Rik
Frances wrote:
this seems pretty straight-forward.. got this code

$link = mysql_connect(' localhost:3306' , '<uid>', '<pswd>');
Do you need the port here? And I assume your username & password are
correct?
What happens if you:
$link = mysql_connect(' localhost', 'your_username' , 'your_password' );

If you want to connect by TCP/IP use 127.0.0.1 instead of localhost.
now on top of pg mentioned above, there this description:

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link [, int client_flags]]]]] )

what does 'resource' refer to here pls...
www.php.net > manual > types > resource:
http://www.php.net/manual/en/languag...s.resource.php

A resource is a special variable, holding a reference to an external
resource.
and where to do specify what
db to connect to... (in java you put db-name in same line where you
make the connection..)
mysql_select_db ('db_name', $link);
(and don't you need a driver to connect, I use a JDBC driver to
connect w/Java..)


Mostly it's enabled by default in PHP4, PHP5 it's not, details:
http://www.php.net/manual/en/ref.mysql.php

Grtz

--
Rik Wasmus
Jun 6 '06 #3
Rik
Frances wrote:
when try to connect just from console get error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost'
(10061)
what is this.. what is 10061.. :(
Try to restart your MySQL-server, if that doesn't work: GOOGLE:
http://www.google.com/search?q=mysql+%22ERROR+2003%22

is it really not possible then to connect to one MySQL server from
diff web servers? (I don't think so..) I want to set up my machine
so can connect to same MySQL server from Tomcat, IIS, PHP.. (the port
thing is also a big pain and don't know if will be able to pull this
off..) thank you very much..


It should not be any problem to connect dozens of times to the same MySQL
database from all kinds of locations, servers, applications.

Rushing into things will give you these kind of errors. You do ask many
questions. Now, take a break, look at some documentation, google the exact
questions you have, and discover a wealth of ready information.

Grtz,
--
Rik Wasmus
Jun 6 '06 #4
Rik wrote:
Frances wrote:
when try to connect just from console get error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost'
(10061)
what is this.. what is 10061.. :(

Try to restart your MySQL-server, if that doesn't work: GOOGLE:
http://www.google.com/search?q=mysql+%22ERROR+2003%22


I did do a google search earlier.. searched for the same thing...
I did find one or two fora where it says to restart the server, but
don't know how you do that.. it says in my book (oreilly) to start the
server to run $ bin/safe_mysqld --user=mysql &... don't see a file
called 'safe_mysqld in C:\Program Files\MySQL\MyS QL Server 4.1\bin..
(why does installation not come with a list of what each executable
in bin dir does? there are lots of them..)

I tried to open mysql.exe earlier, saw a glimpse of a shell window,
which then disappeared.. could this have caused the problem.. it says
in manual to run 'bin\mysqld --console' I navigated to bin dir and did

mysqld --console get error.. then did:
mysqld.exe --console also get error....

manual says to run bin\mysqld -- there's no such file in bin dir.. this
is frustrating.. (still don't know what happened.. why after having
used this server for about a year with no problems would I need to
restart server all of a sudden..)

ok, I think I need to switch to mysql newsgroup.. what a pain.. either
way thank you for your help..

Frances

Jun 7 '06 #5

| manual says to run bin\mysqld -- there's no such file in bin dir.. this
| is frustrating.. (still don't know what happened.. why after having
| used this server for about a year with no problems would I need to
| restart server all of a sudden..)

Use the XAMPP Control Applet, and click on the MySQL START button ;-)

(you are still using XAMPP?). By-the-way, check earlier thread for more.

D.
Jun 7 '06 #6
Virginner wrote:
| manual says to run bin\mysqld -- there's no such file in bin dir.. this
| is frustrating.. (still don't know what happened.. why after having
| used this server for about a year with no problems would I need to
| restart server all of a sudden..)

Use the XAMPP Control Applet, and click on the MySQL START button ;-)

(you are still using XAMPP?). By-the-way, check earlier thread for more.

D.


Virninner, thank you for yr response.. I was trying to connect not to
MySQL that came w/xampp but to my 4.1 installation that I've been using
with java for over a year (I want to set everything up so I can connect
to same db with Tomcat/java, IIS, PHP.. but not getting very far for
now....;) now cannot connect to db at all, I mean to db I've been using
for a while, since before I installed xampp.. never had a problem w/it
before...

when try to connect just to console get error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

(do you think it has to do w/MySQL installation that came with XAMPP
(although I have uninstalled XAMPP completely by now.... want to
install it again at some point (I think it's still simpler than
installing and configuring Apache and
http://us2.php.net/downloads.php...) separately..) but don't know if
it's xampp that screwed my MySQL server I had installed... oh brother,
don't know what to do.. thank you for your help...
Jun 7 '06 #7
| ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

.... means simply that the server is not running....

if it was running, you'd get an error message from the server, like pass
wrong or something.

CRTL-ALT-DEL, open task manager and look for it!!!

D.


Jun 7 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3637
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on Linux, connecting to MS SQL Server, unless it was already pre-installed by your Linux installation, is to build your own multithreaded TCP socket server on Windows and connect to it through the socket API in PHP on Linux (if you have installed...
2
3223
by: Ramir Santos | last post by:
my analysis server is hosted on a win2k server with IIS, the hosting page is on another machine. I have followed everything as per MS KB article and I could not connect through the analysis server using http. i have similar implementation on my dev machine but the main difference is my OLAP is on top of winxp. i just wanted to know if i am missing any other setting not specified on the MS KB article on how to implement OLAP cube through...
4
2387
by: TP | last post by:
Hi, This is probably my 7th post of the day. not spamming, just want to get the questions out, so that I can find the answers and post them back or some good soul can help me out. Right now I am using DB2 connect version 7.2 to connect to db2 version 7.1.1 on os390/zos. Could I use a third party driver to do this? What would you recommend and is connecting to db2 on the mainframe a lot different than connecting to db2 on the pc?
12
2789
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed both the iis and sql server in a single machine. Not too long ago, the machine had some hardware problems, and management has decided to purchase new servers, for both asp.net and sql server.
3
2243
by: Jeremy Dillinger | last post by:
I am trying to design a program that will use data from a MySQL database. Currently all the data is being used with PHP scripts from a website. I am also trying to build a software solution that can use the same data. I have gone through all the data connectors in Visual Basic.net and none of them have the options for connecting to MySQL. Does anybody know how I would go about doing this? Thanks in advance! Jeremy
0
3057
by: NewsReader | last post by:
Hello, I have been looking around the net for a script to help me connect to and help gather information from Cisco routers/switches. I have pieced together a couple of different scripts from various different sources. I am having issue when connecting to Cisco devices. For some reason the scripts timesout/stops working just after the connection section of the script. It does not give me a confirmation of completeion nor does it give me...
0
2035
by: cj.snead | last post by:
Hello, I am having trouble connecting to a remote named instance of SQL Server via Pocket PC. I have had absolutely no luck connecting with VS 2005 (even to a default instance), so I wen't back to VS .NET 2003 (I had success doing this a while back). I am trying to connect to a named instance of SQL. This is where I think my problem is. My app errors out at the Connection.Open(); command. Here is my connection string:
0
1546
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've my win32 application which connecting to my sql database. till now i used MSDE as my database and now i want to upgrade to sql express 2005. after the upgrade i tried to connect to the database and couldn't. i keep getting an error which saying that database doesn't exists or access is denied. is there something diffrent between connecting to MSDE and connecting to sql express 2005 ? here with my connection string.
10
15954
by: mairhtin o'feannag | last post by:
Hello, I'm having problems connecting to my new v9 db box. The pertinent information is below: DB2_db2inst1 60000/tcp DB2_db2inst1_1 60001/tcp DB2_db2inst1_2 60002/tcp DB2_db2inst1_END 60003/tcp
0
2005
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ((string)(this.GetPropertyValue("Address1")));
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.