CodeTalk
CodeTalk

Reputation: 3657

Can't connect to Mysql - issue with my.cnf

I cannot seem to login properly to mysql on my amazon ec2 instance.

I am getting this error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock'

If I view my.cnf at /etc/mysql/my.cnf

it has the socket declaration as:

socket          = /var/run/mysqld/mysqld.sock

When, it is really looking for /opt/bitnami/mysql/tmp/mysql.sock (based on the error)

My question is, how do I basically reset this value: /opt/bitnami/mysql/tmp/mysql.sock to point to /var/run/mysqld/mysqld.sock as currently setup in my.cnf ?

I've already verified, that /var/run/mysqld/mysqld.sock exists in this location

Thank you!

Upvotes: 2

Views: 1367

Answers (2)

Mauricio Montoya
Mauricio Montoya

Reputation: 1

Hope this answer helps, I had the same problem on one of my servers at GC with Bitnami LampStack installed on Debian. Run this command:

sudo ln -s /opt/bitnami/mysql/tmp/mysql.sock /tmp

If you stop and start again MySQL service, you will need to run the command again.

Best regards,

Upvotes: 0

genegc
genegc

Reputation: 1702

I ran in to the same problem after restarting my EC2 server - I couldn't connect to mysql. When I ran:

sudo /opt/bitnami/ctlscript.sh status

it said that mysql was not running.

I had to do

sudo service mysql stop
sudo /opt/bitnami/ctlscript.sh restart mysql

Upvotes: 3

Related Questions