Reputation: 1304
This command:
mysql -uroot -p
Gives the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
But running the same with sudo privileges, works:
sudo mysql -uroot -p
My MySQL Server installation is a custom one, as i needed the 5.1 version, so i downloaded the RPM from the official website, converted it to deb using alien, and installed it with dpkg. The file named: /var/lib/mysql/mysql.sock exists, but it's owner is the mysql user.
Please, how could i get rid of the sudo requirement?
Ubuntu 14.04 MySQL Server 5.1.73 MySQL Client 5.5.37
Upvotes: 3
Views: 8762
Reputation: 356
You need to change the permissions to /var/lib/mysql/ and the sock file to let it be readable by other users than root. You can try this one:
sudo chmod -R 755 /var/lib/mysql/
Upvotes: 8
Reputation: 103
I don't think you can since the user you specify with the -u option is root. To be root you need sudo. You can try creating another user. That way you shouldn't need sudo.
Upvotes: -4