无法在 Ubuntu 12.04 中安装 MariaDB 5.5 或 10。MYSQLD 无法启动?

无法在 Ubuntu 12.04 中安装 MariaDB 5.5 或 10。MYSQLD 无法启动?

我尝试在 Ubuntu 12.04 服务器上安装 MariaDB。首先,它给出了依赖性问题,我按照以下问题修复了它:https://stackoverflow.com/questions/16214517/installing-mariadb-unmet-dependencies-mariadb-server-5-5

但是在安装 mariadb-server 时,无法启动 mysqld。以下是 apt 日志:

    root@sinha:/etc/apt# sudo apt-get install mariadb-server
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      libdbd-mysql-perl libmariadbclient18 libmysqlclient18 mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-server-10.0 mariadb-server-core-10.0 mysql-common
    Suggested packages:
      tinyca mailx mariadb-test
    The following NEW packages will be installed:
      libdbd-mysql-perl libmariadbclient18 mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-server mariadb-server-10.0 mariadb-server-core-10.0
    The following packages will be upgraded:
      libmysqlclient18 mysql-common
    2 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
    Need to get 30.8 MB of archives.
    After this operation, 105 MB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mysql-common all 10.0.1-mariadb1~precise [8,826 B]
    Get:2 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mariadb-common all 10.0.1-mariadb1~precise [3,304 B]
    Get:3 http://lk.archive.ubuntu.com/ubuntu/ precise/main libdbd-mysql-perl amd64 4.020-1build2 [106 kB]
    Get:4 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main libmariadbclient18 amd64 10.0.1-mariadb1~precise [846 kB]
    Get:5 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main libmysqlclient18 amd64 10.0.1-mariadb1~precise [2,956 B]
    Get:6 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mariadb-client-core-10.0 amd64 10.0.1-mariadb1~precise [1,814 kB]
    Get:7 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mariadb-client-10.0 amd64 10.0.1-mariadb1~precise [5,103 kB]
    Get:8 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mariadb-server-core-10.0 amd64 10.0.1-mariadb1~precise [5,517 kB]
    Get:9 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mariadb-server-10.0 amd64 10.0.1-mariadb1~precise [17.4 MB]
    Get:10 http://mirrors.supportex.net/mariadb/repo/10.0/ubuntu/ precise/main mariadb-server all 10.0.1-mariadb1~precise [2,992 B]
    Fetched 30.8 MB in 1s (17.0 MB/s)      
    Preconfiguring packages ...
    (Reading database ... 119368 files and directories currently installed.)
    Preparing to replace mysql-common 5.5.31-0ubuntu0.12.04.1 (using .../mysql-common_10.0.1-mariadb1~precise_all.deb) ...
    Unpacking replacement mysql-common ...
    Selecting previously unselected package mariadb-common.
    Unpacking mariadb-common (from .../mariadb-common_10.0.1-mariadb1~precise_all.deb) ...
    Selecting previously unselected package libmariadbclient18.
    Unpacking libmariadbclient18 (from .../libmariadbclient18_10.0.1-mariadb1~precise_amd64.deb) ...
    Preparing to replace libmysqlclient18 5.5.31-0ubuntu0.12.04.1 (using .../libmysqlclient18_10.0.1-mariadb1~precise_amd64.deb) ...
    Unpacking replacement libmysqlclient18 ...
    Selecting previously unselected package libdbd-mysql-perl.
    Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.020-1build2_amd64.deb) ...
    Selecting previously unselected package mariadb-client-core-10.0.
    Unpacking mariadb-client-core-10.0 (from .../mariadb-client-core-10.0_10.0.1-mariadb1~precise_amd64.deb) ...
    Selecting previously unselected package mariadb-client-10.0.
    Unpacking mariadb-client-10.0 (from .../mariadb-client-10.0_10.0.1-mariadb1~precise_amd64.deb) ...
    Selecting previously unselected package mariadb-server-core-10.0.
    Unpacking mariadb-server-core-10.0 (from .../mariadb-server-core-10.0_10.0.1-mariadb1~precise_amd64.deb) ...
    Processing triggers for man-db ...
    Setting up mysql-common (10.0.1-mariadb1~precise) ...
    Installing new version of config file /etc/mysql/my.cnf ...
    Setting up mariadb-common (10.0.1-mariadb1~precise) ...
    Selecting previously unselected package mariadb-server-10.0.
    (Reading database ... 119534 files and directories currently installed.)
    Unpacking mariadb-server-10.0 (from .../mariadb-server-10.0_10.0.1-mariadb1~precise_amd64.deb) ...
    Selecting previously unselected package mariadb-server.
    Unpacking mariadb-server (from .../mariadb-server_10.0.1-mariadb1~precise_all.deb) ...
    Processing triggers for ureadahead ...
    ureadahead will be reprofiled on next reboot
    Processing triggers for man-db ...
    Setting up libmysqlclient18 (10.0.1-mariadb1~precise) ...
    Setting up libdbd-mysql-perl (4.020-1build2) ...
    Setting up libmariadbclient18 (10.0.1-mariadb1~precise) ...
    Setting up mariadb-client-core-10.0 (10.0.1-mariadb1~precise) ...
    Setting up mariadb-client-10.0 (10.0.1-mariadb1~precise) ...
    Setting up mariadb-server-core-10.0 (10.0.1-mariadb1~precise) ...
    Setting up mariadb-server-10.0 (10.0.1-mariadb1~precise) ...
     * Stopping MariaDB database server mysqld                                                                                                                                                              [ OK ] 
    130427 13:43:14 [Note] Plugin 'InnoDB' is disabled.
    130427 13:43:14 [Note] Plugin 'FEEDBACK' is disabled.
     * Starting MariaDB database server mysqld                                                                                                                                                              [fail] 
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mariadb-server-10.0 (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of mariadb-server:
     mariadb-server depends on mariadb-server-10.0; however:
      Package mariadb-server-10.0 is not configured yet.
    dpkg: error processing mariadb-server (--configure):
     dependency problems - leaving unconfigured
    Processing triggers for libc-bin ...
    ldconfig deferred processing now taking place
    No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                              Errors were encountered while processing:
     mariadb-server-10.0
     mariadb-server
    E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试重新安装 mariadb-server,清除所有内容...删除了 mysql 包,安装了 mariadb-server-5.5... 没有任何作用。

答案1

这对我有用:

sudo apt-get purge mysql* mariadb*

答案2

通过清除 mysql* 和 mariadb* 解决了该问题。然后通过搜索删除所有 mysql 的痕迹:

find / -name mysql*

lib 中有一些残留。删除它们后,重新启动服务器并再次安装 mariadb!成功了。

答案3

我在 Ubuntu 12.04.4 LTS 中尝试安装 MariaDB 10 时遇到了同样的问题,其他解决方案都不起作用。根本原因是内存不足(我的 VPS 有 512MB)。

/var/log/syslog在尝试安装 MariaDB 之后,我通过查看发现了这一点,我看到了以下内容:

mysqld_safe[29684]: InnoDB: mmap(274726912 bytes) failed; errno 12
mysqld_safe[29684]: 140420 17:11:03 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
mysqld_safe[29684]: 140420 17:11:03 [ERROR] Plugin 'InnoDB' init function returned error.
mysqld_safe[29684]: 140420 17:11:03 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysqld_safe[29684]: 140420 17:11:03 [Note] Plugin 'FEEDBACK' is disabled.
mysqld_safe[29684]: 140420 17:11:03 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't exist
mysqld_safe[29684]: ERROR: 1146  Table 'mysql.user' doesn't exist
mysqld_safe[29684]: 140420 17:11:03 [ERROR] Aborting
mysqld_safe[29684]:
mysqld_safe[29684]: 140420 17:11:03 [Note] /usr/sbin/mysqld: Shutdown complete

注意:我已从每个日志行的开头删除了日期/时间和我的主机名。

然后我创建了交换文件(256MB就足够了)并运行:

sudo aptitude install -f

安装完成。

我不知道是否可以用相同的方式修复此错误的每个实例,但考虑到 EAPubs 的答案涉及重新启动服务器,我想知道这是否是真正的修复方法:通过重新启动释放内存。

答案4

虽然我当前的发行版是 14.04,但我的修复应该与类似的问题有关。

我遇到了这个依赖/无法配置 mariadb 问题,试图将我的 mysql/克隆到新安装上 - 没有工作。

我的解决方法:

 - cd /var/lib
 - sudo service mysql stop
 - sudo cp -R mysql _mysql
 - sudo apt-get purge mysql* mariadb*
 - sudo rm -R mysql
 - sudo apt-get install mariadb-client mariadb-server
 - sudo cp -Ruv _mysql/. mysql/.
 - sudo mysql -u root -p ididityay! show databases
 - :D
 - sudo rm -R _mysql

相关内容