Search code examples
mysqlsocketssystemfreebsdmysql-error-2002

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)' on FreeBSD


Hello guy's i have this problem :

root@Myname:~ # mysql -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)
root@Myname:~ # chown -R mysql /var/db/mysql
chown: mysql: illegal user name
root@Myname:~ #

I do not know how to fix this please help

System operations : FreeBSD 9.2 x64


Solution

  • It sounds like you've only installed the mysqlXX-client port instead of the server. To install the server (assuming 5.6), you can use the ports system:

    cd /usr/ports/databases/mysql56-server
    make install
    

    If you haven't installed the ports tree, first run:

    portsnap fetch
    portsnap extract
    

    To ensure it gets started up on a reboot, you would enable it using the rc.conf system:

    echo 'mysql_enable="YES"' >> /etc/rc.conf.local
    

    And then you can start it up:

    /usr/local/etc/rc.d/mysql-server start
    

    Let me know if that gets you to where you need to be.