Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-10-30
6
Medium Priority
?
700 Views
Last Modified: 2008-02-07
Hi all,

I'm trying to use MySQL to log data from Snort, but I can't get MySQL to work. When I enter mysql.exe, I receive the following error:


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

Here's my my.ini:
[mysqld]
basedir=C:\EagleX\MySQL
bind-address=127.0.0.1
datadir=C:\EagleX\MySQL\data
skip-innodb
#language=C:\EagleX\MySQL\share\your language directory
#slow query log#=
#tmpdir#=
port=7788
#set-variable=key_buffer=16M
[WinMySQLadmin]
Server=C:/EagleX/MySql/bin/mysqld-nt.exe
user=*****
password*******
QueryInterval=10

Any suggestions would be greatly appreciated!!!

0
Comment
Question by:meade470
6 Comments
 
LVL 8

Assisted Solution

by:lokus
lokus earned 400 total points
ID: 12454875
First, make sure your mysql server is running, you can confirm it by running
> mysqld --console
It should tell you a server is already running on port: 7788, you have set to run mysql server on port 7788.
If it is not running, this will start the mysqld server.

In order to connect to mysql server uisng mysql, you need to specify the port number because your mysqls server is running on port 7788 as specified in your config file, not the default port 3306
Try:
> mysql -P7788
to specify the port number 7788

Note that mysql.exe is a client to connect to MySQL server, it is not the database itself.

0
 
LVL 26

Assisted Solution

by:Umesh
Umesh earned 400 total points
ID: 12456112
Hi,

well u must check whether or not ur mysql server is running..also your path separator must be / or // and not \..so do accordingly in my.ini file..



basedir=C:/EagleX/MySQL
bind-address=127.0.0.1
datadir=C:/EagleX/MySQL/data
skip-innodb
#language=C:/EagleX/MySQL/share/your language directory
#slow query log#=
#tmpdir#=
port=7788
#set-variable=key_buffer=16M
[WinMySQLadmin]
Server=C:/EagleX/MySql/bin/mysqld-nt.exe
user=*****
password=*******
QueryInterval=10

0
 
LVL 6

Accepted Solution

by:
Duane Lawrence earned 800 total points
ID: 12456479
I am just guessing that this is a brand new database and a new user, here are some instructions on getting MySQL running for the first time.  If that is not the case, then you definatly have a permisions problem at the least, this will also solve the permissions problem.

Duane

#1.
# I downloaded and installed MySQL just fine, Using it is proving
# to be difficult. It should be noted that the "HELP" is in the
# manuals and can be found on the following path:
# file:///C:/mysql/Docs/manual_toc.html

#2. Run c:\mysql\bin\winmysqladmin.exe, it will set up a user
# and a password.
# These are entered into the my.ini file by winmysqladmin.exe.
# You can look them up if you forget. For this purpose,
# the user name is John and the password is foo.

#3.
# IMPORTANT NOTE: THE '#' IS THE BEGINNING OF COMMENTS.
#using the mysql.exe shell from a command line.
#The second mysql specifies the database your connecting to.
mysql mysql -h localhost -u root -p
password
#IMPORTANT: Before I did the above command, when I did a
#'show databases;' the only one I got was the test database.


#4. now grant all to user on the PC your on.
#where testpc is the name of the computer that MySQL is on
#and where xxx is the password.
grant all privileges on *.* to john@testpc identified by 'foo' with grant option;


#5. finally create the database.
create database foo;


#FOOTNOTE:
#CANT RUN MYSQL.EXE
#Add "c:\mysql\bin" to the "path" in system variables.
# That is assuming you installed MySQL to the "c:\mysql"
# How to get there: Open the control panel in Windows,
# open the system, goto the advanced tab, click on the
# "enviornment variables" button, edit the path and add
# the above.
# This can be found on http://www.duanelawrence.com


------------------------------------------------------------------------------
# Thing to do after you can create a database.

use mysql;

show columns from user;

# see the below website for ANSI SQL lesson.
# http://www.samspublishing.com/articles/article.asp?p=30875&seqNum=4

------------------------------------------------------------------------------
# IMPORTANT SAFETY TIP: CHANGE THE ROOT PASSWORD FROM ITS DEFAULT OF BLANK!
mysqladmin -u root -h testbox password 'new-password'


duane
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 2

Author Comment

by:meade470
ID: 12458805
Great info, guys--but now I'm really confused.  This is what I know.

When I type this at the command line:
mysql mysql -h localhost
I receive a list of options/switches.

When I type this at the command line:
mysqld-nt --console
It tells me that its: "Ready for connections."

Why I search my entire harddrive, I can't find a "my.cnf" file.  Am I supposed to have one?

Please help!




0
 
LVL 8

Expert Comment

by:lokus
ID: 12460066

When I type this at the command line:
mysqld-nt --console
It tells me that its: "Ready for connections."

If that is what you got as above, your mysql server was NOT started in the first place, that is why the command started it for you, if your mysql server had already started, the command will say so and will not start another server process.
Please read http://dev.mysql.com/doc/mysql/en/Windows_installation.html
to familiar yourself with the complete installation steps.

As for the file my.cnf, it is equivalend to your my.ini file.
0
 
LVL 2

Author Comment

by:meade470
ID: 12496943
I think I was having a right's issue.  I reinstalled MySQL and everything is fine.  Thanks for your help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question