由于时区,apt-get upgrade在mariadb-server上总是失败

时间:2015-04-10 15:30:24

标签: mysql linux timezone mariadb apt-get

MariaDB 10.1.3,内核3.19.3,Debian

问题:由于mariadb-server timezone问题,apt-get upgrade总是失败。

my.cnf包含

[mysqld]
default_time_zone=America/New_York

我还导入了tzinfo:

# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

当我手动停止/启动服务时,没有问题:

# service mysql restart
[ ok ] Stopping MariaDB database server: mysqld.
[ ok ] Starting MariaDB database server: mysqld ..
[info] Checking for corrupt, not cleanly closed and upgrade needing tables..

但是,每次运行apt-get upgrade时,它总是在mariadb-server上失败:

# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up mariadb-server-10.1 (10.1.3+maria-1~wheezy) ...
[ ok ] Stopping MariaDB database server: mysqld.
dpkg: error processing mariadb-server-10.1 (--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.1 (= 10.1.3+maria-1~wheezy); however:
  Package mariadb-server-10.1 is not configured yet.

dpkg: error processing mariadb-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mariadb-server-10.1
 mariadb-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

错误是:

# tail /var/log/syslog
mysqld_safe[32269]: [ERROR] Fatal error: Illegal or unknown default time zone 'America/New_York'

这种情况发生在多台服务器上,已经成为一种真正的烦恼。可以使用你的帮助。顺便说一句,它不是MariaDB版本,因为这个错误在几个版本中持续了几年。

编辑添加:我忘了提及如果从my.cnf中删除default_time_zone参数,apt-get upgrade确实有效。只有当该参数存在时,apt-get升级才会失败。它需要出现在我的配置中。

编辑2:为了确保清晰,即使在删除default_time_zone之后,然后成功进行apt-get升级,然后添加回default_time_zone并重新启动 - 将来的mariadb- *升级将通过apt失败。 apt-get升级过程中有一些特定的过程与正常的服务启动不一致。

2 个答案:

答案 0 :(得分:2)

有同样的问题。这对我有用:

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo apt-get install mariadb-server

备份/ var / lib / mysql文件夹,因为所有数据都将被删除

答案 1 :(得分:0)

也许答案是" MySQL安装过程在mysql数据库中创建时区表,但不加载它们。您必须使用以下说明手动执行此操作..."

See Manual page

您也可以选择提交有关安装错误的错误报告。