Ubuntu12.04上安装MySQL Server提示mysql-server : Depends: mysql-server-5.1

来源:互联网 发布:台风战斗机 知乎 编辑:程序博客网 时间:2024/05/25 19:55

     今天帮师弟安装服务器,在安装mysql-server的时候,出现了

   eading package lists... Done
   Building dependency tree       
   Reading state information... Done
   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 instaed

  E: Unable to correct problems, you have held broken packages.

   初步估计是系统自带安装源出了问题,在网上搜索了几个安装源来更新都没解决。后来在阿里云帮助中心找到了一个解决方案。

   方法一:

               cp -a /etc/apt/source.list /etc/apt/source.list.bak    //备份/etc/apt/source.list文件
               vim /etc/apt/source.list
               在最前面添加一下内容
               deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
               deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
               deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
               deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
               deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
               deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
               deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
               deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
               deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
               deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
               sudo apt-get update  && sudo apt-get -y upgrade//更新一下列表
         

   方法二:     

             1.通过wget http://oss.aliyuncs.com/aliyunecs/update_source.tgz 下载update_source的压缩包。

             2.tar xvf update_source.tgz解压后予执行权限 chmod 777 update_source.sh。

             3.执行该脚本./update_source.sh进行自动变更源操作。

    我采用的是方法一,更新了源之后,再输入命令:

             sudo apt-get install mysql-server

              即可以正常安装mysql。

  

 

1 0
原创粉丝点击