zack_falcon zack_falcon - 9 months ago 39
MySQL Question

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

I've been given the task of running a program that relies on a MySQL database, specifically, the 3.23.42 version. I have to install MySQL, run a .batch file that reads an SQL file (to create the required tables and such), then run the program. Seems simple enough.

I got as far as installing MySQL. I was expecting it to ask username and passwords and such, as was my experience with installing SQL Server and MySQL version 5 (and later), but it needed nothing from me. Attempts to run the .batch file, however, yields the error:

"MySQL Error 2003: Can't connect to MySQL server on 'localhost' "

So I ran Command prompt as an administrator, went to the MySQL directory, and ran "mysql". It gave me the same error as above.

Running the commands "mysqld-nt" or "mysqld" didn't do anything, so I'm assuming there's another problem at work here. Neither did I find any 'mysql' in the running services or process.

At this point, it doesn't matter if the program runs or not. I need the database up and running first.

Although I've used MySQL before, I can't say I have that much experience with it, and it had always been up and running already; this is the first time I'm deploying it myself.

Of note is that:
I haven't tried to reinstall the program yet, although I'm not sure if it will fix anything.
I've installed MyODBC-3.15.05, if it means anything (part of the instructions).
I'm using Windows 7, 32-bit (I have heard MySQL doesn't like to play nice with Windows 7).
I'm using this setup as both the server and the client; had the entire process been successful, I was to do the same thing on another computer. No computer actually uses another as a server.
I don't exactly know what services to look for in the services list.

Is there anything I can do to fix this problem?



Answer Source

Well, I don't exactly know what caused this issue in the first place, but I was able to find a way to solve it. A helpful, if old - perfect in this case - tutorial I found on the web, that hopefully can help others with the same problem.

Tutorial: Install MySQL 4.0 - Windows, by Dr. Thomas E. Hicks Computer Science Department Trinity University

Link Here