3

I recently installed MySQL on my machine using MySQL installer. I am using it as part of an Apache Tomcat server I'm running on localhost.

I linked the database to Netbeans and everything was working fine. A couple of weeks ago I accidentally shut off my machine - the battery became disconnected - and when I turned it back on I could not connect to the database.

Whether I tried to connect via the command line, MySQL workbench or Netbeans I got an error telling me I could not connect to the database.

I've tried the following to fix the problem -Reinstalled MySQL server, workbench, etc -Reinstalled MySQL in different location -Stopped MySQL via the services window and started it again -Reconnected to Netbeans

Here's an example of the errors.

I get this when testing the connection while creating a new connection in Workbench:

enter image description here

After I make a connection (ignoring the fact the connection test fails) and trying to connect (still in Workbench)

enter image description here

Can someone please please help me? This is for my final year college project and I haven't been able to do anything for the past couple of weeks because of this. It's really annoying and I've tried everything I can think of.

Brian Byrne
  • 31
  • 1
  • 1
  • 2
  • You didn't say if MySQL is actually running while you run these tests. Please note that "actually running" != "I started the service". You also didn't say what you found in the MySQL error log when you looked at it. 'cause you looked there first, right? – Luke404 Dec 10 '11 at 22:29
  • Right, I tried telnet localhost 3306 and got this error: Could not open connection to the host, on port 3306: Connection failed. – Brian Byrne Dec 11 '11 at 14:45

1 Answers1

1

Open up command prompt and type :

netstat -anto | findstr 3306

If you get output the mysql server is running , else the server is not running in this case check mysql service status in services.msc

EviLiNsiDe
  • 61
  • 2
  • 1
    That's not answering my question, but I get no output, just a blank line. I'm not having trouble running the sever - rather I'm having trouble connecting to it. – Brian Byrne Dec 11 '11 at 13:55
  • Got it! I used the steps outlined here: http://stackoverflow.com/questions/2547855/1130-host-localhost-is-not-allowed-to-connect-to-this-mysql-server – Brian Byrne Dec 11 '11 at 15:05