2002 Error With My Sql
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
Mysql Error 2002 Windows 7
this site About Us Learn more about Stack Overflow the company Business Learn mysql error 2002 centos more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Mysql Error 2002 Can't Connect
x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ERROR mysql error 2002 (hy000) 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) up vote 181 down vote favorite 60 I installed LAMP on Ubuntu12.04 LTS (Precise Pangolin) and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to change password through terminal I get: ERROR 2002 (HY000): Can't connect to local MySQL error 2002 (hy000) mysql ubuntu server through socket '/var/run/mysqld/mysqld.sock' (2) How can I fix this? I am unable to open LAMP, uninstall it or reinstall it. mysql phpmyadmin lamp mysql-error-2002 share|improve this question edited Mar 13 at 1:06 Braiam 3,27282656 asked Jul 25 '12 at 20:10 sushmit sarmah 1,1292912 Probably reinstall it is easier: stackoverflow.com/a/31984482/763744 –Zernel Aug 13 '15 at 9:34 Reset the password by stopping MySQL and starting it in safe mode skipping the --grant tables –davejal May 29 at 21:58 add a comment| 56 Answers 56 active oldest votes 1 2 next up vote 128 down vote I once had this problem and solved it by installing mysql-server, so make sure that you have installed the mysql-server, not the mysql-client or something else. That error means the file /var/run/mysqld/mysqld.sock doesn't exists, if you didn't install mysql-server, then the file would not exist. But if the mysql-server is already installed and is running, then you need to check the config files. The config files are: /etc/my.cnf /etc/mysql/my.cnf /var/lib/mysql/my.cnf In /etc/my.cnf, the socket file config may be /tmp/mysql.sock and in /etc/mysql/my.cnf the socket file config may be /var/run/mysqld/mysqld.sock. So, remove
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter
Mysql Error 1045
Useful Links Distrowatch Bugs: Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists! Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk
Mysql: Unrecognized Service
[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 http://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run 123 ... Last Jump to page: Results 1 to 10 of 50 Thread: MySQL ERROR 2002 (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 https://ubuntuforums.org/showthread.php?t=804021 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, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # This will be passed to all mysql clients # It has been reported that passwords should be enclosed with ticks/quotes # escpecially if they contain "#" chars... # Remember to edit /etc/mysql/debian.cnf when changing the socket location. [client] port = 3306 socket = /var/run/mysqld/mysqld.sock # Here is entries for some specific programs # The following values assume you have at least 32M ram # This was formally known as [safe_
have one accepted answer. Are you sure you want to replace the current answer with this one? Yes, I'm sure. Changed your mind? You previously marked this answer as accepted. Are you sure you want to https://www.digitalocean.com/community/questions/mysql-can-t-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-sock-2 unaccept it? Yes, I'm sure. Sign Up Log In submit Tutorials Questions Projects Meetups http://ahmed.amayem.com/solving-mysql-error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-varlibmysqlmysql-sock-2/ Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main Site Sign Up Log In submit View All Results By: decaobr Subscribe Subscribed Share 1 MySQL -Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) September 30, 2014 80.9k views I currenty have a LAMP, running on Ubuntu 14.04, yesterday everything was fine, but today my mysql error MYSQL is not working. When i try to connect via mysql -u root -p I get the error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) the Mysql.err file is completely empty, and have absolute no ideia about what to do. 2 comments 0 empty September 30, 2014 Is it running? 3 sreejithkb September 18, 2015 I think you didn't started your database server, start it using #services mysql error 2002 mysql start or #/etc/init.d/mysql start If you are getting a failure message while starting, check the log file (/var/log/syslog), if you found socket connection error message there, then check for correct socket file location #find / -type s, if you found a mysqld.sock file under /var/run/mysqld/ directory, check whether any instances of mysqld running or not #netstat -anpt | grep 3306 or #ps aux | grep mysqld if you found any running process stop it (#kill -9 pid) and remove the socket file. Then try to restart it and if mysql not creating socket file then try start it like #/usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock Also check your my.cnf file (/etc/mysql/my.cnf) and comment the bind-address field, and if you found any skip-network field comment it. regards, sreejith kb Log In to Comment Leave a Comment Add comments here to get more clarity or context around a question. To answer a question, use the “Answer” field below. Log In to Comment 6 Answers 0 decaobr September 30, 2014 I tried to reboot my server, and now its completely off. Reply Log In to Comment 0 decaobr September 30, 2014 Server is back online, Mysql still completely dead. 0 decaobr September 30, 2014 Problem solved, basically i had to purge and reinstall mysql. Using this http://stackoverflow.com/questions/22909060/mysql-job-failed-to-start Reply L
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 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 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 -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: 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 was helpful 1 person found this article useful Post navigation Replacing (yum-plugin-replace) one yum install package (php) with another on Linux (CentOS 6) Installing WordPress (Site and Multi