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
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.