[chef] Re: Unable to connect to the mysql database server


Chronological Thread 
  • From: Marco Betti < >
  • To:
  • Subject: [chef] Re: Unable to connect to the mysql database server
  • Date: Sun, 15 Feb 2015 16:59:15 +0100

Looking at the error message it seems it's looking for socket file in the wrong place.
Cheers
Marco

Il 15/feb/2015 12:52 "Anthony Kong" < "> > ha scritto:
I used the following lines in my cookbook

mysql_service 'default' do
  bind_address '0.0.0.0'
  initial_root_password 'password'
  action [:create, :start]
end

And here is the my.cnf

# Chef generated my.cnf for instance mysql-default

[client]
default-character-set          = utf8
port                           = 3306
socket                         = /run/mysql-default/mysqld.sock

[mysql]
default-character-set          = utf8

[mysqld]
user                           = mysql
pid-file                       = /run/mysql-default/mysqld.pid
socket                         = /run/mysql-default/mysqld.sock
bind-address                   = 0.0.0.0
port                           = 3306
datadir                        = /var/lib/mysql-default
tmpdir                         = /tmp
log-error                      = /var/log/mysql-default/error.log
!includedir /etc/mysql-default/conf.d

[mysqld_safe]
socket                         = /run/mysql-default/mysqld.sock


But I am unable to login:

mysql -u mysql -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


I have also tried login 'root' and it did not work either.

What did I miss in my cookbook?

Cheers, Tony



Archive powered by MHonArc 2.6.16.

§