我尝试使用安装 MySQL
sudo apt-get install mysql-server
,然后我收到一条错误消息
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
当我输入时sudo apt-get install mysql-server-5.1
,它显示:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-server-5.1 : Depends: mysql-client-5.1 (>= 5.1.69-0ubuntu0.11.10.1) but it is not going to be installed
Depends: libdbi-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages."
当我输入时mysql,
,它说,
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
我试过了sudo apt-get remove --purge mysql-client-5.1
,但是它说
mysql-client is not installed so it can't be uninstalled.
我应该怎么办?
答案1
当我输入“mysql”时,它显示“错误 2002 (HY000): 无法通过套接字‘/var/run/mysqld/mysqld.sock’连接到本地 MySQL 服务器 (2)”
您可以通过以下方式登录 mysql 数据库
mysql -u root -p
并不是mysql
安装过程中,系统会提示您输入密码,您必须在此处输入该密码才能登录。
为了修复 dep 问题,你可以尝试
sudo apt-get install -f