aspose file tools*
The moose likes JDBC and the fly likes can't connect Mysql 5.2 server on '127.0.0.1' (10061) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "can Watch "can New topic
Author

can't connect Mysql 5.2 server on '127.0.0.1' (10061)

pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
when I try to connect my mysql server it says "can't connect Mysql 5.2 server on '127.0.0.1' (10061)". I have opened the port and installed connector too.
I am following all the steps given in the following link for windows vista

http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-configuration-dsn-windows.html

Thanks in advance
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Have you tried connecting via MySQL Workbench (formerly GUI Tools)? This will let you know if the problem is with the server or with your application.


My Blog: Down Home Country Coding with Scott Selikoff
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
Scott Selikoff wrote:Have you tried connecting via MySQL Workbench (formerly GUI Tools)? This will let you know if the problem is with the server or with your application.


yes that's what I have been doing..once we open MySQL workbench we can see three options..SQL Development, Data Modeling and Server Administration.

Underneath SQL Development there is an option NEW CONNECTION..that's how i am trying to connect but unable get connection.

Also if I try to setup connection by installing connector it is not getting connected and gives the same error..I have successfully made a connection of MSSQL and postgreSQL server through connector..
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Mysql is usually a username at a client address, not just a username. % means any host, hence root@% would allow root to connect from anywhere. User@127.0.0.1 would allow that user to connect from the same machine Provided they specify localhost or ip in the jdbc url. If you use the host name or ip then the user needs permission from that host too, even though it is the same machine!
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
I am unable to make connection using Connector/ODBC
I am entering the following values
DATA SOURCE NAME: Hiteshmysql
DESCRIPTION: mysqlconnection
TCP/IP SERVER: localhost PORT: 3306
USER: root
PASSWORD: root
DATABASE: Is it necessary to select databse from list? I don't get any any name here to select database so leave it blank.

When I click on TEST then it gives me following error...
"Connection Failed:[HY000][MYSQL][ODBC 5.1 Driver] Cn't connect to MySQL server on 'localhost' (10061)

help me guys.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Why are you using ODBC?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
Don't i need ODBC connector for connecting MYSQL workbench?

To make a connection in MySQL workbench..i am entering following values
Connection name: Big Iron Server
Connection Method: TCP/IP Server
Hostname:127.0.0.1 Port:3306
Password:root(store in vault)

after that if i click on test connection then it gives me following error
" Can't connect to MySQL server on '127.0.0.1' (10061)"
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
also if i want write jdbc programs using eclipse and MySQL i need to make jdbcdbc connection, right?
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

If your connecting to MySQL from a Java application, you should be using the Connector/J. Take a look at the following and go from there. ODBC sounds like its completely unrelated to what you're attempting to do.

http://dev.mysql.com/doc/refman/5.0/en/connector-j.html
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
right now I am not using any java application. I am learning MySQL workbench for that i have to make connection, right?
I am unable to make a connection using MySQL Workbench that's my main problem...
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

OK... Are you sure your server is running? Are you sure you are using the same port on both your client and server? Are you sure you don't have a firewall program blocking access? Also, try using localhost instead of 127.0.0.1, and make sure you have those connection properties allowed for that user.

Most of the time MySQL uses 3306 as the default port so after installing MySQL and Workbench on the same computer, the two can connect to each other pretty easily, unless blocked by a third party application.
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
I have checked the box in the windows firewall to make an exception for MySQL Workbench...and made a connection using NEW SERVER INSTANCE (Admin@127.0.0.1 Local Type:Windows) but it still says " There is no connection to the MySQL Server. This functionalit requires an established coonection to a running MySQL server to work".
pintu shah
Greenhorn

Joined: Nov 12, 2010
Posts: 24
I downloaded the ZIPPED MySQL Server 5.2.29 from www.mysql.org and unzipped it. Finally I ran mysqld.exe which is located in the bin folder to start the server by manually clicking on the icon mysqld.exe. Now i can also make connection using MySQL workbench.

The Issue is now resolved.

Thank you everyone for your valuable suggestions. I appreciate them.
jai ddscsdds
Greenhorn

Joined: Feb 09, 2011
Posts: 1
1)when you installed mysql, you must have skipped networking because you are working on a local machine
result -->does not create a address field in your configuration file my.ini or my.cnf if its linux

2)When you install mysql workbench, it tries to connect from your given credentials and looks for that line in my.ini, which is not there.
so it can never connect even though mysql client can connect from shell

solution:

1)stop mysql
2)add this line to you server section of mysql configuration file

bind-address=127.0.0.1

3)Restart MySQL
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

Welcome to CodeRanch, jai ddscsdds!.

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
marc dasi
Greenhorn

Joined: Dec 07, 2011
Posts: 1
THANKS ...THANKS ...THANKS
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't connect Mysql 5.2 server on '127.0.0.1' (10061)