apt-get upgrade always fails on mariadb-server due to timezone - mysql

MariaDB 10.1.3, kernel 3.19.3, Debian
Problem: apt-get upgrade always fails due to mariadb-server timezone issue.
my.cnf contains
[mysqld]
default_time_zone=America/New_York
I also imported the tzinfo:
# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
When I manually stop/start the service, there is no issue:
# 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..
However, every single time I run apt-get upgrade, it always fails on 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)
The error is:
# tail /var/log/syslog
mysqld_safe[32269]: [ERROR] Fatal error: Illegal or unknown default time zone 'America/New_York'
This is happening on multiple servers and has become a real annoyance. Could use your help. BTW, it isn't the MariaDB version, as this error has persisted for a couple of years throughout several versions.
EDIT TO ADD: I forgot to mention if I remove the default_time_zone parameter from my.cnf, apt-get upgrade does work. It is only when that parameter is present that apt-get upgrade fails. It needs to be present for my configuration.
EDIT 2: To ensure clarity, even after removing default_time_zone, then doing apt-get upgrade successfully, then adding back default_time_zone and restarting -- future mariadb-* upgrades will fail via apt. There is something specific to the process during apt-get upgrades that is not consistent with a normal service start.

Had the same issue. This is what worked for me:
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
Backup /var/lib/mysql folder, as all data in will be deleted

Perhaps the answer is "The MySQL installation procedure creates the time zone tables in the mysql database, but does not load them. You must do so manually using the following instructions..."
See Manual page.
You may choose to file a bug report about the installation error, too.

Related

Unatttended MySQL 8 community install on Ubuntu 18.04 WSL

I am trying to install MySQL 8 on an Ubuntu (that is a Windows Subsystem for Linux) without any prompts.
I have the following script:
apt-key add --keyserver pgp.mit.edu --recv-keys 5072E1F5
echo 'deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0' > /etc/apt/sources.list.d/mysql.list
apt-get update --yes
apt-get install --yes debconf-utils
echo 'mysql-community-server mysql-community-server/root-pass password' | sudo debconf-set-selections
echo 'mysql-community-server mysql-community-server/re-root-pass password' | sudo debconf-set-selections
apt-get install --yes mysql-community-server
(partly constructed thanks to the answers in this question)
and it appears to work fine, except that it prompts me to select authentication method... I want to pick the mysql_native_password and do so without being prompted interactively.
I'm guessing the solution is another debconf-set-selections setting, but... In addition to asking what is it for this case... Is there a reference of all possible options somewhere?
There's also the issue that apt-get says that a symlink is created for the service, and yet the service isn't created... But that's not really a showstopper, as I'm using WSL merely as a test ground for an actual Ubuntu server, where I'd think this would work... hopefully.
EDIT1: Nevermind the original question... I managed to find an answer here
which led to stumble upon this dockerfile
So I ended up adding
echo 'mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)' | sudo debconf-set-selections
is the line I need...
HOWEVER, the other, possibly WSL specific issue remains... that is, no MySQL service is created. I should note that while I have MySQL outside of WSL, the server is turned off, specifically so that the WSL could run.
I get the following output upon the install, near the end:
Setting up mysql-community-server (8.0.16-2ubuntu18.04) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
mysql-community-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
And the only thing I can find related to that is suggestions of complete reinstall, but even reinstalling the WSL instance doesn't fix this.
EDIT2: Adding
apt-get dist-upgrade --yes --allow-remove-essential --allow-change-held-packages
Fixes the above error, and yet despite there not being any errors, the service is still not created.
I sort of fixed the missing mysql service by copying the /etc/init.d/mysql file from another WSL instance (mysql 8 installed through an upgrade) to /etc/init.d
sudo service mysql start
returns a [fail], but the mysql daemon runs just fine.
Otherwise, I've seen people achieve this more cleanly by installing a lower version from MySQL's repo first, and then upgrade to mysql 8.

Can't Installing mysql in Linux mint 19

I am a beginner Linux user. Yesterday, I tried to install MySQL on my Linux mint laptop. I have installed Apache successfully, but I have got the following errors while trying to install MySQL.
Setting up mysql-server-5.7 (5.7.25-0ubuntu0.18.04.2) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (237-3ubuntu10.17) ...
Processing triggers for ureadahead (0.100.0-20) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get dist-upgrade
I have tried to find a way again from the web but nothing works and I can't sleep because of this..:(
I installed MySQL on Mint numerous times, but I recently started to have the same problem - all out of the blue.
Try the steps here:
https://vitux.com/how-to-install-and-configure-mysql-in-ubuntu-18-04-lts/
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation
You will have a few yes and no options for your MySQL server. Choose as appropriate for you, then log in using sudo mysql, not just mysql
sudo mysql -uroot -p
The prompt will change from whatever your linux login user is to mysql>
For a list of the users automatically created:
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
Change the authentication method for root user, and assign a new password if you want:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Now you will be able to access MySQL server from MySQL workbench. In all honesty, I suggest to use that because it makes your life much easier.

Cannot install MySQL - libaio.so.1: cannot open shared object file: No such file or directory - Live Installation with Persistence

I decided to sign up to askubuntu.com, because i really need an advice from experts: I made, with mkusb, a persistent USB Live installation of Ubuntu 16.10, since I'd like to have a portable development environment. Everything went good, and I'm writing from that Live right now.
Now the question: I managed to install apache2, but after hours and hours of searching in the web, and also on this site, I cannot still properly install MySQL server. After re-executing many time the installation, I continue to get this error:
Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.10.1) ...
ERROR: Unable to start MySQL server:
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
And if I run
sudo mysqld --initialize
The terminal still reports
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
So i thought to search for this "libaio.so.1" as well, and I finished up installing the libraries "libaio1" and "libaio-dev" (which seems to be the same). The result, however didn't change even if those libraries are correctly installed.
Is this caused from the fact that I'm in a LiveUSB? Or is there another procedure to install/make MySQL recognize (since it's already installed, and I verified that the file exists) libaio.so.1?
I really hope you can help me, because i tried everything. I apologize in advance for any possible mistake made in this question. Thank you.
Oh, and there is an unanswered duplicate on the Ubuntu community made by me, so feel free to remove this question if it stays unanswered. Thank you in advance again.
After more many hours of research, i found that the problem wasn't the LiveUSB or the library itself. The problem was AppArmor, who blocked MySQL to use that library. So I disabled it:
sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown
sudo update-rc.d -f apparmor remove
And a not-so-orthodox way, I completely removed AppArmor, to prevent future problems with:
sudo apt-get purge apparmor
Then I uninstalled and reinstalled MySQL Server flawlessy. It works!
If you got here while installing MariaDB, you can install the libaio1 using below command. The above solutions did not work for me
sudo apt-get install libaio1
Reference is here
maybe you should uninstall mysql and install it again using these command
remove mysql -
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
reinstall
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation

MySQL Fails to Reinstall (Ubuntu 12.10 Server)

I'm running a Wordpress installation on an Ubuntu 12.10 server. The site was running fantastically until we had sporadic MySQL issues, where the site would "whitescreen" for a few hours, then return to normal.
Someone who should not have been toying around with the server removed MySQL to attempt a reinstall, and now mySQL refuses to reinstall. I get the following errors when running sudo apt-get install -f mysql-server from root.
Setting up mysql-server-5.5 (5.5.35-0ubuntu0.12.10.2) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.
dpkg: error processing mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.5
mysql-server
In addition, I couldn't connect to MySQL through the socket before this all happened.
Things I've tried, as recommended here/on other websites:
Restarting mysqld Deleting and (attempting) reinstallation of mysql-server
deleting all files shown when running dpkg -S etc/mysql
apt-get purge mysql-server mysql-client mysql-common mysql-client-5.5 mysql-server-5.5
apt-get auto cleans
apt-get with the -f flag
Numerous server reboots and restarts
Tears
Have you tried entering this through terminal/PuTTy?
apt-get install mysql-server mysql-client

MySQL Won't Install on Ubuntu 11.04

It was working fine before and I was configuring the email server when I restarted the mysql (via /etc/init.d/mysql restart). I'm pretty sure that I did not touch anything in there but I can remember doing a failed apt-get update prior to that.
Now my problem starts when all of a sudden it stops and won't even start. I searched on google and even went far to purging everything and doing a new install. But still it won't let me install mysql properly.
I've tried (after doing a remove --purge):
sudo apt-get install mysql-server-5.5 mysql-client-5.5
and it prompts me for a root passsword, but returns me the following error:
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative user. This may have
happened because the account already has a password, or because of a communication problem with the
MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.
and I have the following logs too:
Selecting previously deselected package mysql-server-5.5.
(Reading database ... 117879 files and directories currently installed.)
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.32-0ubuntu0.12.04.1_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up mysql-server-5.5 (5.5.32-0ubuntu0.12.04.1) ...
130830 14:13:26 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)
any help? Thanks in advance.
this question was having the same issue it solved by uninstalling but before that he tried to set the password that is the question and then he tried to solve it in chat maybe when you try to set a password it will be solved , just try
Update: Type the following commands in your terminal in order to make a complete remove for mysql.
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Also you need to remove the /var/lib/mysql folder if exist by typing the following command
sudo rm -rf /var/lib/mysql
Then follow the official ubuntu documentation to install. and don't forget to set your mysql password during installation.
Also see this question its similar to the error you have got during the installation process.
I experienced this problem.
maybe aptitude have some config for package.
I think this problem of interference
Although, this method is purge command .
try running.
check installed mysql package
dpkg --get-selections|grep mysql
remove
apt-get remove --purge [installed package]
apt-get autoremove
apt-get autoclean
aptitude purge [installed package]
aptitude clean
aptitude update
aptitude -f install
aptitude full-upgrade
install
apt-get install mysql-server