![无法在 Ubuntu 12.04.5 LTS 中通过套接字“/var/run/mysqld/mysqld.sock”连接到本地 MySQL 服务器](https://linux22.com/image/1051916/%E6%97%A0%E6%B3%95%E5%9C%A8%20Ubuntu%2012.04.5%20LTS%20%E4%B8%AD%E9%80%9A%E8%BF%87%E5%A5%97%E6%8E%A5%E5%AD%97%E2%80%9C%2Fvar%2Frun%2Fmysqld%2Fmysqld.sock%E2%80%9D%E8%BF%9E%E6%8E%A5%E5%88%B0%E6%9C%AC%E5%9C%B0%20MySQL%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
我遇到了错误无法在 Ubuntu 12.04.5 LTS 中通过套接字“/var/run/mysqld/mysqld.sock”连接到本地 MySQL 服务器。 所以我卸载mysql5.5来自 Ubuntu 12.04.5 LTS。但是当我尝试安装 mysql,我无法安装 mysql。
我使用以下命令来卸载 mysql:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get remove --purge mysql-server-5.5 mysql-client-5.5 mysql-servercore-5.5 mysql-client-core-5.5
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo deluser mysql
我使用以下命令来安装mysql 5.5:
sudo apt-get install mysql-server-5.5
sudo apt-get install mysql-server
但我遇到了以下错误:
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 9: Could not open 'abstractions/mysql'
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我从终端输入“mysql”时,它返回错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
我试过远程登录 127.0.0.1 3306谷歌搜索后,它返回连接被拒绝。
有人可以建议一个解决方案吗?
我运行sudo apt-get 安装 mysql 服务器并得到输出为:
Setting up mysql-server-5.6 (5.6.24-2+deb.sury.org~precise+2) ...
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [fail]
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.6; however:
Package mysql-server-5.6 is not configured yet.
dpkg: error processing mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing:
mysql-server-5.6
mysql-server
E: 子进程 /usr/bin/dpkg 返回错误代码 (1)