最近啟動mysql總是會報錯Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
最近本人的mac,不管是使用命令brew services start mysql
還是在 /usr/local/Cellar/mysql@5.7/5.7.27_1 目錄下執(zhí)行?./support-files/mysql.server stop 都會報錯Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
1又憨、第一步查看/tmp/mysql.sock文件是否存在辜王,發(fā)現(xiàn)/tmp目錄下只有一個mysql.sock.lock文件,于是執(zhí)行命令:
cp mysql.sock.lock mysql.sock?
2艘希、再次啟動mysql届良,會報錯/usr/local/var/mysql/xxxxxdemacbook-pro-2.local.pid?is not finded竟贯,于是新建一個空的文件xxxxxdemacbook-pro-2.local.pid,并修改權(quán)限 chown -Rf _mysql:admin?xxxxxdemacbook-pro-2.local.pid
3甩栈、不管使用那種方式啟動mysql都可以成功