Linux Mysql Error 2002
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists! Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation mysql.sock missing Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just
Mysql: Unrecognized Service
like you, helping each other. Join them; it only takes a minute: Sign up error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' up vote 117 down vote favorite 57 I'm just new to mysql so
Check That Mysqld Is Running And That The Socket: '/var/run/mysqld/mysqld.sock' Exists!
I apologize for any silly questions. My problem started off with me not being able to log in as root anymore into my mysql install. I was attempting to run mysql without passwords turned on... but whenever I would run the command : # mysqld_safe --skip-grant-tables & I would never get a prompt back... (I was trying to follow the instructions here: http://www.cyberciti.biz/tips/recover-mysql-root-password.html) The screen just looks like this: root@jj-SFF-PC:/usr/bin# mysqld_safe --skip-grant-tables 120816 11:40:53 mysqld_safe mysql error 2002 mac Logging to syslog. 120816 11:40:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql and I don't get a prompt to start typing the sql commands to reset the password. When I kill it by doing a CTRL + C, I get the following message: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists! If I retry the command and leave it long enough, I do get the following series of messages: root@jj-SFF-PC:/run/mysqld# 120816 13:15:02 mysqld_safe Logging to syslog. 120816 13:15:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 120816 13:16:42 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended [1]+ Done mysqld_safe --skip-grant-tables root@jj-SFF-PC:/run/mysqld# But then if i try to log in as root by doing: # mysql -u root I get the following error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) I checked and /var/run/mysqld/mysqld.sock file doesn't not exist. The folder does, but not the file. Also, I dunno if this helps or not, but I found did a find / -name mysqld and it came up with: /var/run/mysqld - folder /usr/sbin/mysqld - file /run/mysqld - folder I'm just new to linux and mysql, so i don't know if this is normal or not. But I'm including this info just in case it helps
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct
Failed To Start Mysql.service: Unit Mysql.service Is Masked.
Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support error 2003 (hy000): can't connect to mysql server on '127.0.0.1' (111) AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch Bugs: Ubuntu PPAs: Ubuntu Web can't connect to local mysql server through socket '/var/run/mysqld/mysqld.sock' (111) Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming http://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq Programming Talk [SOLVED] MySQL ERROR 2002 (HY000): Can't connect to local... Having an Issue With Posting ? Do you want to help us debug the posting issues ? < is the place to report it, thanks ! Page 1 of 5 123 ... Last Jump to page: Results 1 to 10 of 50 Thread: MySQL ERROR 2002 https://ubuntuforums.org/showthread.php?t=804021 (HY000): Can't connect to local... Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode May 23rd, 2008 #1 sevenearths View Profile View Forum Posts Private Message Visit Homepage Gee! These Aren't Roasted! Join Date Feb 2008 Location Swansea Beans 144 DistroUbuntu 9.04 Jaunty Jackalope MySQL ERROR 2002 (HY000): Can't connect to local... I upgraded to 8.04 recently and during the upgrade process Ubuntu asked me if I wanted to change one of my mysql configuration files and I must have clicked yes which is why I am in a bit of a pickle now. I currently get the following when I try to log in: Code: arthur@localhost:/etc/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) And my /etc/mysql/my.cnf is as follows: Code: # # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options,
Solving MySQL ERROR 2002 (HY000): Can't connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock' (2) Posted on September 3, 2014February 3, 2015 by Ahmed Amayem I came upon this error after installing the latest http://ahmed.amayem.com/solving-mysql-error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-varlibmysqlmysql-sock-2/ version of MySQL using yum and securing it. The Error With mysqld running I tried to run mysql as follows: [ahmed@amayem ~]$ mysql ERROR 2002 (HY000): Can't connect to local MySQL http://forums.mysql.com/read.php?10,561011 server through socket '/var/lib/mysql/mysql.sock' (2) Different failed attempts: Here are more attempts to get it working: [ahmed@amayem ~]$ telnet 127.0.0.1 3306 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused [ahmed@amayem ~]$ mysql error mysql -h 127.0.0.1 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) [ahmed@amayem ~]$ mysql -h 127.0.0.1 -P 3306 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) [ahmed@amayem ~]$ mysql -h 127.0.0.1 -P 3306 -u root ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) [ahmed@amayem ~]$ mysql -h 127.0.0.1 -P 3306 -u root -p Enter password: mysql error 2002 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) The Solution [ahmed@amayem ~]$ cd /etc/init.d/ [ahmed@amayem init.d]$ ./mysqld stop Stopping mysqld: [ OK ] [ahmed@amayem init.d]$ sudo ./mysqld start Starting mysqld: [ OK ] Basically we just restarted mysqld. Now the error changes: [ahmed@amayem init.d]$ mysql ERROR 1045 (28000): Access denied for user 'ahmed'@'localhost' (using password: NO) This is good, now we just need to use a user that has access, like root that was made when we secured the install. [ahmed@amayem init.d]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. And we are in. The Reason (Conjecture) Since it started working after manually restarting mysqld, I would have to guess that when it was restared it made /var/lib/mysql/mysql.sock, which might have been missing. Unfortunately I didn't check on its existence before, so I can't confirm. If anyone has a reason please mention it in the comment section. This entry was posted in Linux System Administration and tagged error, Linux, mysql, technical. Bookmark the permalink. 1 person found this article useful This article was helpful This article
Community Podcasts MySQL.com Downloads Documentation Section Menu: MySQL Forums :: Newbie :: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) New Topic Advanced Search ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Posted by: Peter Lauren () Date: July 12, 2012 07:34PM OK. There are a myriad of posts about this but there does not appear to be any one solution that works. I have tried other people's solutions but they do not work. I have LAMP installed on Ubuntu 11.10. I type $ mysql and get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) I tried $ sudo service mysql stop and got mysql stop/waiting then $ sudo rm /var/run/mysqld/mysqld.sock then $ sudo service mysql start and got mysql start/running However, when I typed $ mysql I got ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Any assiatance with this would be greatly appreciated. Also are there any plans to fix this problem with mysql? Many thanks in advance, Peter Navigate:Previous Message•Next Message Options:Reply•Quote Subject Written By Posted ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Peter Lauren 07/12/2012 07:34PM Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Martín Colodrero 07/12/2012 09:29PM Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Peter Lauren 07/13/2012 07:21PM Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Martín Colodrero 07/13/2012 08:34PM Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Peter Lauren 07/13/2012 09:30PM Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Martín Colodrero 07/13/2012 09:56PM Re: ERROR 2002 (HY0