0

As I was working on a rails app my environment suddenly crashed and when i went to restart my local server my entire development environment seems to have been reset. I was able to get the server working again however now I cannot reconnect to MySQL and keep getting the following error...

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

When i try to reinstall the gem i am not able to perform a bundle install due to a mismatch in the required and active ruby versions. (rvm seams to have disappeared also)

Any help would be greatly appreciated as I don't want to potentially corrupt my work.

dsteinbr1
  • 77
  • 11
  • 1
    it appears the MySQL server crashed. You can restart this. I'd suggest looking at the mysql error log to determine the nature of the crash. Include it in the question if you need clarification. – danblack Oct 07 '18 at 03:30
  • What OS do you use? How did you install MySQL? Are there any errors in your `mysql.log` (especially when you try to restart the server)? What does the error message say? – spickermann Oct 07 '18 at 05:59
  • did you checked this solution for mysql? https://stackoverflow.com/questions/6599524/cant-connect-to-mysql-server-on-localhost-10061-on-window-7 – Nezir Oct 07 '18 at 06:01

2 Answers2

0

First thing I should do is to check is your MySQL server running:

How do I know if MySQL is running?

  1. For Ubuntu: # service apache2 status.
  2. For CentOS: # /etc/init.d/httpd status.
  3. For Ubuntu: # service apache2 restart.
  4. For CentOS: # /etc/init.d/httpd restart.

You can use mysqladmin command to find out whether mysql is running or not.

If not running then start it (for ubuntu) with:

sudo start mysql or sudo service mysql start or (Note: Older Method) sudo /etc/init.d/mysql start

and for problem about resetting your environment you should provide us more info about your system.

Nezir
  • 6,727
  • 12
  • 54
  • 78
  • 1
    Most modern Linux distros also allow the use of *systemctl* eg. `systemctl restart mysql` – 3limin4t0r Oct 07 '18 at 11:21
  • For clarification I am using Windows 10. I have tried all the commands listed above but get an error in the command line for both "sudo" and "service commands saying they are not recognized as a command. – dsteinbr1 Oct 07 '18 at 13:51
  • for windows check these or you can search google for exact version of windows and like 'windows 10 check is mysql running' https://stackoverflow.com/questions/10885038/stop-mysql-service-windows – Nezir Oct 07 '18 at 14:01
  • Still not working, I am getting a service name invalid error – dsteinbr1 Oct 07 '18 at 14:43
  • are you sure that you have installed mysql in your system? – Nezir Oct 07 '18 at 15:24
0

I'm still unsure as to what caused the problem in the first place but I was able to eventually solve it by re-installing MySQL. It had been installed previously but the files appeared to have gotten lost as they were no longer able to be located by the PATH.

dsteinbr1
  • 77
  • 11