Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting MySQL on Bash on Ubuntu on WIndows

Tags:

mysql

ubuntu

I've installed MySQL:

sudo apt-get install mysql-server

I've tried to start the service:

sudo service mysql start

But everytime I start it I get the message:

*Starting MySQL database server mysqld [fail]

I've tried reinstalling MySQL, killing any related running process, but nothing I've tried this entire week has worked.

I've also tried directly logging into mysql with the command below,

mysql -u root -p

But I would get the following error message:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Edits: I fixed a typo. I forgot to include "sudo" in the start command. This also did not work for me. I also added in what would happen if I tried to login to MySQL

like image 959
Prem P. Avatar asked May 29 '17 16:05

Prem P.


1 Answers

So I was finally able to get MySQL to start. After doing everything I mentioned above, I looked into the error.log file, located at:

/var/log/mysql/error.log

I looked into it and the most important lines I found were:

2017-05-29T03:51:16.559247Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Permission 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] Aborting

I opened up Run and opened services.msc (Remember, I'm using Bash on Ubuntu on Windows), and scrolled 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 ended up working finally.

like image 189
Prem P. Avatar answered Sep 20 '22 12:09

Prem P.