JIRA can't connect to mySQL under CentOS

Daniel Broz May 12, 2014

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 12, 2014

Usually means mysql isn't running.

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

Daniel Broz May 12, 2014

@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:

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2014

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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 12, 2014

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)

Daniel Broz May 12, 2014

@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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 12, 2014

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.

Daniel Broz May 12, 2014

@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:

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 12, 2014

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

Daniel Broz May 12, 2014

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?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 12, 2014

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)

0 votes
Daniel Broz May 12, 2014

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.

Bruna Griebeler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2014

Hi Daniel,

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

Thanks for sharing your resolution with us!

Cheers!

0 votes
codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2014

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

Suggest an answer

Log in or Sign up to answer