Home  >  Article  >  Database  >  Ubuntu7.10中mysql安装不上与不能登录的对策

Ubuntu7.10中mysql安装不上与不能登录的对策

WBOY
WBOYOriginal
2016-06-07 16:51:231535browse

说到这个问题,我很惭愧,正是我的前一篇文章ldquo;Ubuntu7.10中配置IP地址(http://www.linuxidc.com/Linux/2008-03/11705.htm)

说到这个问题,,我很惭愧,正是我的前一篇文章“Ubuntu7.10中配置IP地址() ”里解决步骤2出了点问题,才导致了mysql不能登录或重新安装时安装不上的问题。在此向大家道歉。

当我配置好ip之后,由于两天时间没有用Ubuntu,所以也没有注意到问题。昨天,我进入Ubuntu系统后,连mysql时突然发现连不上了,出现的错误信息是:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)。在网上一搜,发现遇到这样问题的用户还真不少,然而,按照一些人给的解决方法试着操作一下,发现根本不行。于是,我在新立得软件包管理器里将mysql彻底删除了,删除后我在终端里用命令sudo apt-get install mysql-server安装,出现了以下问题:

* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [fail]
invoke-rc.d: initscript mysql, action "start" failed.
dpkg:处理 mysql-server-5.0 (--configure)时出错:
子进程 post-installation script 返回了错误号 1
dpkg:依赖关系问题使得 mysql-server 的配置工作不能继续:
mysql-server 依赖于 mysql-server-5.0;然而:
软件包 mysql-server-5.0 还没有被配置。
dpkg:处理 mysql-server (--configure)时出错:
依赖关系问题 - 仍未被配置
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
在处理时有错误发生:
mysql-server-5.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我用命令 sudo dpkg --configure -a命令试着修复一下,仍然是在这儿出现问题导致无法修复。无奈,我在新立得里装,可是仍然不行,还是出现“ mysql-server 依赖于 mysql-server-5.0;然而:
软件包 mysql-server-5.0 还没有被配置。 ”等字样的错误。我在Ubuntu中文论坛上查了一下午,也没有找到解决方法。无奈,我作出了我最不愿意作的选择:重装Ubuntu,装上之后,我先配置一下ip,然后装各种软件,等装到mysql时,还是出现问题。我想这应该是给我的ip有关了。

于是,我打开终端:输入命令:sudo gedit /etc/network/interfaces

然后将:#auto lo
#iface lo inet loopback前的“#”去掉,因为“#”是我后加的,刚装好系统时前面是没有“#”的,是我配置ip时加上的。然后保存。重启

一下系统后重装mysql,发现没有问题了。至此,问题解决。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn