connect to local MySQL server through socket

試著忘記壹切 提交于 2019-11-27 21:33:49

I did experiments and finally solve it with these commands

sudo chown mysql:root /var/lib/mysql/ -R
sudo chmod g+rw /var/lib/mysql/ -R
sudo /usr/sbin/mysqld --skip-grant &

It get running...... Hurraaahhhhhhhhhh!!!!!!!!!!!!

Your log actually tells you the issue:

mysqld: Too many arguments (first extra is 'start').

Just start the daemon without the word 'start'. Instead of:

sudo /usr/sbin/mysqld start

it should be just:

sudo /usr/sbin/mysqld

It looks like either it can't create a file in /var/lib/mysql/. If you look at the errode 13, it is generally means permission errors.

1) Make sure that mySQL can write to the directory /var/lib/mysql and/or that mySQL owns that directory. Do a:

cd /var/lib ; ls -la | grep mysql

To be sure.

2) If you are trying to start with the mySQL user, start it with root instead (You probably are, but it's worth checking).

3) If you are running something like SElinux, make sure that you enable it for mySQL access. I doubt that is the case, but it's worth checking.

4) Small note: Don't create the sock file - mysql will create one once it is up and running properly. If it still in the run directory, delete it.

Kamal Asawara

If you have multiple mysql servers installed then make sure you run the correct MYSQL or change your path settings. For example:

/opt/lampp/bin/mysql -u root -p 

I have XAMPP installed , the solution worked for me.

Try to kill the socket with (this may depend on your OS)

rm /var/lib/mysql/mysql.sock rm: remove socket `/var/lib/mysql/mysql.sock'? y restart the service

service mysqld start

Milad Naseri

Have you tried?

sudo touch /etc/apparmor.d/local/usr.sbin.mysqld

More background info here: https://askubuntu.com/a/127029

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!