Running MySQL on Bash on Ubuntu on WIndows
I installed MySQL:
sudo apt-get install mysql-server
I tried to start the service:
sudo service mysql start
But every time I start, I get the message:
* Starting the MySQL database server mysqld [fail]
I've tried reinstalling MySQL, killing any associated process, but haven't tried anything all week.
I have also tried to login to mysql directly using below command,
mysql -u root -p
But I am getting the following error:
ERROR 2002 (HY000): unable to connect to local MySQL server via socket '/var/run/mysqld/mysqld.sock' (2)
Edit: I've corrected a typo. I forgot to include "sudo" in the startup command. It also didn't work for me. I also added what happens if I try to login to MySQL
source to share
So, I was finally able to start MySQL. Having done everything I mentioned above, I looked at the error.log file located at:
var / log / mysql / error.log
I went through it and the most important lines I found were:
2017-05-29T03: 51: 16.559247Z 0 [ERROR] Unable to start server: Bind to TCP / IP port: Access denied
2017-05-29T03: 51: 16.559401Z 0 [ERROR] Do you already have another mysqld server running on port: 3306?
2017-05-29T03: 51: 16.559558Z 0 [ERROR] Cancel
I opened Run and opened services.msc (remember, I am using Bash on Ubuntu on Windows) and scroll down to find "MySQL57". The service was running, so I stopped it.
Then I went back to my terminal and ran "sudo service mysql start", which eventually exited.
source to share