Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have installed percona server using using macports on my mac machine however I am running into the socket error above as you can see below:

Sauds-MacBook-Pro:percona jini$ sudo /opt/local/lib/percona/bin/mysql_secure_installation

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


    In order to log into MySQL to secure it, we'll need the current
    password for the root user.  If you've just installed MySQL, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.

    Enter current password for root (enter for none): 
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/percona/mysqld.sock' (2)

The weird part is that I am able to connect to mysql on command line and using php. It is just when I try to run the above command that it is failing.

Here are the contents of my my.cnf:

[mysql]

# CLIENT #
port                           = 3306
socket                         = /opt/local/var/db/percona/mysql.sock

[mysqld]

# GENERAL #
user                           = mysql
default-storage-engine         = InnoDB
socket                         = /opt/local/var/db/percona/mysql.sock
pid-file                       = /opt/local/var/db/percona/mysql.pid

# MyISAM #
key-buffer-size                = 32M
myisam-recover                 = FORCE,BACKUP

# SAFETY #
max-allowed-packet             = 16M
max-connect-errors             = 1000000

# DATA STORAGE #
datadir                        = /opt/local/var/db/percona/

# CACHES AND LIMITS #
tmp-table-size                 = 32M
max-heap-table-size            = 32M
query-cache-type               = 0
query-cache-size               = 0
max-connections                = 10
thread-cache-size              = 16
open-files-limit               = 65535
table-definition-cache         = 1024
table-open-cache               = 2048

# INNODB #
innodb-flush-method            = O_DIRECT
innodb-log-files-in-group      = 2
innodb-log-file-size           = 5M
innodb-flush-log-at-trx-commit = 2
innodb-file-per-table          = 1
innodb-buffer-pool-size        = 12G

# LOGGING #
log-error                      = /opt/local/var/db/percona/mysql-error.log
log-queries-not-using-indexes  = 1
slow-query-log                 = 1
slow-query-log-file            = /opt/local/var/db/percona/mysql-slow.log

As you can see that I am not referencing "opt/local/var/run/percona/mysqld.sock" anywhere and it is still trying to look for the file there.

I only see mysql.sock listed at /opt/local/var/db/percona

srwxrwxrwx   1 _mysql  _mysql         0 Jan 24 06:37 mysql.sock

Also see:

Sauds-MacBook-Pro:percona jini$ mysql_config --socket
/opt/local/var/run/percona/mysqld.sock

Why is it trying to find "/opt/local/var/run/percona/mysqld.sock" and more so why am i getting this error?

UPDATE: So if I create a symbolic link :

sudo ln -s /opt/local/var/db/percona/mysql.sock /opt/local/var/run/percona/mysqld.sock

everything works. However I still do not have the answer to why I did not have a mysqld.sock file in the first place.

share|improve this question

closed as off-topic by Sven, Jenny D, Ward, Falcon Momot, mdpc Jan 26 at 3:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – Sven, Jenny D, Ward, Falcon Momot, mdpc
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

my.cnf can be located in several different places, with some taking priority of others. Look at http://stackoverflow.com/questions/2482234/how-to-know-mysql-my-cnf-location for where they might be. If you have another my.cnf located somewhere, it might be pulling the configuration from that.

share|improve this answer
    
I checked all the places where my.cnf could be read based on your answer above and was unable to find any other instance. I tried finding in finder for a way to search for "/opt/local/var/run/percona/mysqld.sock"and did not find anything. this is so weird –  kratos Jan 24 at 18:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.