0

Tried all posts for solution . ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

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

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

During Follow ups got another issue.. sudo: effective uid is not 0, is sudo installed setuid root?

So for this Tried following post

http://ubuntuforums.org/showthread.php?t=2222715

sudo: effective uid is not 0, is sudo installed setuid root?

Also got this chown: changing ownership of `/usr/bin/sudo': Operation not permitted

anybody give perfect solution for this.. Except re-installing OS.. I don't have rescue disk for recovery.

Community
  • 1
  • 1
Varun Chawla
  • 303
  • 1
  • 6
  • 19
  • How you're connecting to mysql , using command line ? if yes please provide the command which you're using. Also tell us what OS is that. – Juned Nov 16 '15 at 05:47
  • yes i'm connected using command line on linux.. I'm using this command mysql -uroot -p – Varun Chawla Nov 16 '15 at 05:53
  • okay and what is mysql service status `/etc/init.d/mysql status` ? – Juned Nov 16 '15 at 05:56
  • Did you try with restarting mysql services ? Also what is the output of `netstat -pan | grep 3306` command ? What OS is that BTW ? – Juned Nov 16 '15 at 06:07
  • Its Ubuntu O/p (No info could be read for "-p": geteuid()=1000 but you should be root.) – Varun Chawla Nov 16 '15 at 06:16
  • I m not able to start/stop services. – Varun Chawla Nov 16 '15 at 06:17
  • How did you installed, give output of this mysql `dpkg --list | grep mysql` – Juned Nov 16 '15 at 06:26
  • dpkg --list | grep mysql ii libdbd-mysql-perl 4.021-1 amd64 Perl5 database interface to the MySQL database ii libmysqlclient18:amd64 5.5.29-0ubuntu0.12.10.1 amd64 MySQL database client library ii libmysqlclient18:i386 5.5.29-0ubuntu0.12.10.1 and more.. – Varun Chawla Nov 16 '15 at 06:42
  • Can you try wth installing mysql again `sudo apt-get install mysql-server` ? – Juned Nov 16 '15 at 06:45
  • Already mentioned anything related to sudo is not working... sudo: effective uid is not 0, is sudo installed setuid root? this error comes.. I think the problem is related to ownership of files... – Varun Chawla Nov 16 '15 at 07:00
  • If you have root access then please just install sudo and fix this permission related issue and then try. As mysql status as stop. there is no way you will be able to connect mysql database, so you need to make that service running first. – Juned Nov 16 '15 at 07:06
  • sudo is installed already, but its ownership is not root... and i'm not able to change ownership.. output of ls -l /usr/bin/sudo is -rwxr-xr-x 2 site site 112888 Jul 16 2012 /usr/bin/sudo and when i change its permission it says sudo: effective uid is not 0, is sudo installed setuid root? – Varun Chawla Nov 16 '15 at 07:14

1 Answers1

0

Try to stop your mysql server and restart it again.

/etc/init.d/mysql  stop
/etc/init.d/mysql  start

Still same issue then rename mysql.sock file from mysql directory e.g. /var/lib/mysql/mysql.sock folder and restart mysql server.

Altmish-E-Azam
  • 1,561
  • 1
  • 13
  • 24
  • /etc/init.d/mysql stop ---> says Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql stop Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the stop(8) utility, e.g. stop mysql when i use stop mysql or service mysql stop it shows unknown instance – Varun Chawla Nov 16 '15 at 05:57
  • Are you able to stop or start mysql using any of the below command.. `/etc/init.d/mysql start` `/etc/init.d/mysqld start` `service mysql start` `service mysqld start` ?? – Altmish-E-Azam Nov 16 '15 at 05:59
  • status mysql shows mysql stop/waiting. service mysql start shows start: Rejected send message, 1 matched rules; type="method_call", sender=":1.30" (uid=1000 pid=2209 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") – Varun Chawla Nov 16 '15 at 06:13
  • /etc/init.d/mysql start shows Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql start Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the start(8) utility, e.g. start mysql start: Rejected send message, 1 matched rules; type="method_call", sender=":1.34" (uid=1000 pid=2223 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") – Varun Chawla Nov 16 '15 at 06:14
  • @VarunChawla... you need to stop mysql forcefully run below command and get hte pid of mysql and kill them... `ps -ef |grep mysql.sock` then kill pid using `kill -9 pid` – Altmish-E-Azam Nov 16 '15 at 06:25
  • ps -ef |grep mysql.sock ravi 3129 2992 0 12:09 pts/1 00:00:00 grep --color=auto mysql.sock kill -9 3129 -bash: kill: (3129) - No such process – Varun Chawla Nov 16 '15 at 06:40
  • Do you know the base directory of mysql?? if yes then go to base directory of mysql and rename `mysql.sock` file to `mysql.sock.bk' and start mysql server. – Altmish-E-Azam Nov 16 '15 at 06:43
  • already mentioned not able to start/stop mysql server... I think the problem is related to ownership of files. output of ls -l /usr/bin/sudo is -rwxr-xr-x 2 site site 112888 Jul 16 2012 /usr/bin/sudo and when i change its permission it says sudo: effective uid is not 0, is sudo installed setuid root? can you help me regarding that. I want to change ownership to root – Varun Chawla Nov 16 '15 at 08:15
  • Let me know you are the owner of the your linux system.. or you are using the shared linux system ?? If you have root level user for linux then you can set the permission for the same... you can set the default permission with a simple command on linux if you have root level user. – Altmish-E-Azam Nov 16 '15 at 09:21
  • yes i am the owner of linux system. Actually i have mount my disk to another system due to some system issue. and run all work using that system. Now when i mount that disk to previous system, it has lost its ownerships. it is not showing the ownership of root. – Varun Chawla Nov 16 '15 at 10:00
  • open a new terminal and run the below command to restore the ownership of FileSystem. `touch /.autorelabel; reboot` this will reboot your system and relabel all file system. – Altmish-E-Azam Nov 16 '15 at 10:44