Solved

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

Posted on 2004-10-30
670 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
Question by:meade470
    6 Comments
     
    LVL 8

    Assisted Solution

    by:lokus
    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:ushastry
    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:
    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
     
    LVL 2

    Author Comment

    by:meade470
    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

    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
    I think I was having a right's issue.  I reinstalled MySQL and everything is fine.  Thanks for your help.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Course: MongoDB Object-Document Mapper for NodeJS

    NodeJS (JavaScript on the server) is awesome, but some developers get confused about NoSQL when it comes to working in Node with MongoDB (NoSQL database). Do you need a better explanation of how to use Node.js with MongoDB? The most popular choice is the Mongoose library.

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    875 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now