Pages

Minggu, 08 Juni 2014

[SOLVED] LAMPP ; ubuntu 12.04 ; ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)



source : http://ubuntuforums.org/archive/index.php/t-1054189.html

symptoms

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

root@server:/opt/lampp/mysql# ls -l /var/run/ | grep mysqld
root@server:/opt/lampp/mysql# cd /var/run/
root@server:/var/run# ls
acpid.pid                   lightdm                       samba
acpid.socket             lightdm.pid                sdp
apache2                     lock                               sendsigs.omit.d
atd.pid                       motd                             shm
avahi-daemon         mount                           squid3.pid
console                      network                        teamviewerd.pid
ConsoleKit                              network-interface-security            udev
console-kit-daemon.pid     NetworkManager.pid          udev-configure-printer
crond.pid                                nm-dns-dnsmasq.conf         udisks
crond.reboot            pm-utils                   upstart-socket-bridge.pid
cups                             pppconfig               upstart-udev-bridge.pid
dbus                            pppd2.tdb               utmp
dhcp-server              resolvconf
initramfs                   rsyslogd.pid

root@server:/var/run# service mysqld start
mysqld: unrecognized service


root@server:/var/run# /etc/init.d/mysqld restart
bash: /etc/init.d/mysqld: No such file or directory

root@server:/var/run# sudo touch /var/run/mysqld/mysqld.sock
touch: cannot touch `/var/run/mysqld/mysqld.sock': No such file or directory
root@server:/var/run# cd

root@server:~# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

***-=======here the solution=========-***
(Pato)² said :
January 30th, 2009, 08:46 PM
XAMPP for linux is a stand-alone app. I prefer it to the native packages as I dislike its configuration.

To solve you problem yo can do this:
$sudo su
#gedit /etc/mysql/my.cnf

And on line number 21 replace "/var/run/mysqld/mysqld.sock" with "/opt/lampp/var/mysql/mysql.sock"

Save it, and it should work fine now :)

(I had the same problem just a minutes ago :p)


root@server:~# gedit /etc/mysql/my.cnf
root@server:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.16 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ^CCtrl-C -- exit!
Aborted
root@server:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.16 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ^CCtrl-C -- exit!
Aborted

0 komentar:

Posting Komentar