JIRA can't connect to mySQL under CentOS

Dear All,

After restarting the Machine, JIRA wouldn't connect to mySQL Database anymore. If i try to connect manually, the output says the following:

ERROR 2002 (HY000): Can't connect to local MySQL Server through Socket '/var/lib/mysql/mysql.sock' (111)

I haven't changed anything. Only shutdown, then making an Image of the Machine and after that booting up.

Can anyone help me?

Best Regards,

Daniel Broz

3 answers

1 vote

Usually means mysql isn't running.

Try logging into the database using the mysql client tools to verify that.

@Nic Brough:

I have tried the connection manually over the mysql Client:

mysql -h localhost -u user -p

But it fails with the output above. Could it be something with localhost and the address 127.0.0.1?

@Mathias Liefke:

This is my config.xml:

Please check the basedir in /etc/my.cnf. Try to comment out the basedir setting and restart your mysql service.

Oops. I forgot. Can you check that MySQL is actually running? You get that error a lot when it's not running. Try "ps -ef | grep -i my"

Possibly, but I'm not sure. Could you also try

mysql -h 127.0.0.1 -u user -p

And

mysql -h ::1 -u user -p

And check the error messages carefully.

(Your Jira config looks absolutely fine, this is a problem with mysql connecting locally. It's a lot easier to debug with the mysql client than Jira)

@Nic:

I have tried everything you suggested, but without success. Unfortunately!

MySQL is not running. IPv6 (::1) is an Unknown Host and to 127.0.0.1 the client can't connect.

Here are my Results:

@Mathias:

I have checked /etc/my.cnf. But I have no BaseDir. Only a DataDir.

Here is the File:

Cheers,

Daniel

Er, well, that's a dead giveaway

>MySQL is not running.

You can't connect to a service that isn't running. Because it isn't running.

You need to start MySQL and retest.

@Nic:

This was only a Summary of the output from the Command you have given and i should execute.

I suppose that the Result is that MySQL is not running. What do YOU mean about the output?

Otherwise i have tried to start the mysql service manually. This is the Result:

The command I gave you (ps -ef | grep -i my) clearly states that there are no processes with "mysql" in their name/description running.

MySQL server almost always runs at least one process with mysqld in the name of it, unless you've deliberately hacked it to run with a totally different name.

The service script is checking the wrong thing, probably a lock from an improper shutdown

I understand. Thanks for your explanation.

And no.. I don't have hacked mysql to run with a different name. :-)

How can i clean the Lock? Is there a process i can kill oder delete a File, that lockdown the Folder or something else?

Well, there's no processes to kill, because the server isn't running.

The situation you're in usually happens when the machine shuts down too "hard" for MySQL to stop in time, or you kill the mysql process with violence, not giving it enough time to clean up.

The first thing I'd try is "mv /var/lib/mysql/mysql.sock ~" - hopefully, that is the only hangover left, and that's what's blocking it. If I'm right about that, then your "./mysqld start" should restart the service and clean up anything else that is lying around. Before using it though, I'd read the logs to see if there are any warnings (they're usually quite good - they'll ask you to restart if there's any need to)

Please post your dbconfig.xml. Perhaps there is a configuration error.

I have resolved the Issue.

Others with the same Problem, should do the followinig:

1. Rename "mysql.sock" to "mysql.sock.bak" (/var/lib/mysql)

2. Start the Service again: "service mysqld start"

3. Try to connect: mysql -h localhost -u user -p

4. Be happy! :-)

But one Thing you have to do additional. If you get the Message, that Jira is locked, you have to delete the File ".jira-home.lock" at the Jira Home Folder. Finally you have to restart the Server and all is fine again.

Hi Daniel,

Although they are important, indeed this sock and lock files are a nightmare sometimes.

Thanks for sharing your resolution with us!

Cheers!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,703 views 17 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you