Last night I tried to upgrade my Ubuntu OS and MySQL 5.7.15 was one of the changes. It seems upgrading is successfull because mysql is propely working, but installation proccess has stop working with this message:
This installation of MySQL is already upgraded to 5.7.15,
use --force if you still need to run mysql_upgradeI can't cancel the installation proccess in reqular way and just have to kill it. So it may cause some problem and also for every other installation (in the future) it tries to do it again.
How to prevent this upgrade or solve it?
5 Answers
This solution solved my problem:
Back-up your database files with permissions:
sudo cp -avt /your/backup/directory /var/lib/mysql /etc/mysql/my.cnfDelete mysql files:
sudo rm -rv /etc/mysqlRemove MySQL completely via running:
sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7 mysql-client-5.7 mysql-client-core-5.7Use of Synaptic is recommended.
Create these folders:
sudo mkdir -p /etc/mysql/conf.dmysql setup didn't do it automatically and I don't know why.
Install MySQL again
sudo apt install mysql-serverI used
sudo apt install lamp-server^instead to install other dependencies for PHP development.Stop MySQL:
sudo service mysql stopRestore databases and files:
sudo cp -a /your/backup/directory/mysql /var/lib sudo cp /your/backup/directory/my.cnf /etc/mysqlRestart MySQL:
sudo service mysql start
An easy solution is to sudo killall mysqld while the apt-get operation is running.
The apt operation just kept on running without any errors after that(!)
3I managed to fix this without having to purge everything. It seems the problem is that the sys schema database was never created, so here's the solution:
- Clone and cd into the cloned folder.
- In a terminal, run mysql -u root -p < ./sys_57.sql (or sys_56.sql, depending on your version)
Enjoy mysql_upgrade working again. I guess this probably was, an upgrading scripts mess-up.
2If your root@localhost account has no password then there is a bug in the postinstall process as stated here(see particularly the last comment of the thread)
- purge all
TMP*files in/var/lib/mysql-files edit the file
/var/lib/dpkg/info/mysql-server-5.7.postinstand comment (using #) the line 370 :echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'auth_socket';" >> "$initfile"run again
sudo dpkg --configure -a
I had this issue too. Every time I started apt get and installed the process would hang after or during the DB update. None of the other solutions here worked.
In the end I purged
sudo apt purge mysql-server mysql-server-5.7And followed the manual install from the instructions for mysql here
I then overwrote the data directory with my old data
sudo cp -Rfv /var/lib/mysql /usr/local/mysql/dataand finally added a systemd service like this
/lib/systemd/system/mysql.service
[Unit]
Description=MySQL Server
After=syslog.target
After=network.target
[Service]
Type=simple
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/run/mysqld
ExecStartPre=/bin/chown mysql:mysql -R /var/run/mysqld
ExecStart=/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
TimeoutSec=300
PrivateTmp=true
User=mysql
Group=mysql
WorkingDirectory=/usr
[Install]
WantedBy=multi-user.targetThen ran
# systemctl daemon-reload
# systemctl enable mysql
# systemctl start mysqlThen everything seemed to be working as before and mysql was not breaking system updates
The downside, of course, is that I'll need to do manual updates in the future.