Ubuntu14 upgrade MySQL

Recently, the MySQL of the test environment needs to be upgraded from 5.6 to 5.7.

I first set up an Ubuntu14 virtual machine to simulate the upgrade.

Started various pit records

Option One

This scheme can be skipped, it is all pits.

Search for Ubuntu14 MySQL Upgrade 5.7, there are many results

After checking, I found that the processing methods are all the same. Since everyone is upgrading like this, there must be a problem. I believe it

1. Download deb package

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.1-1_all.deb

2. Installation

sudo dpkg -i mysql-apt-config_0.8.1-1_all.deb

Choose MySQL5.7

3. Update apt source

sudo apt update

Reported an error,

Find a solution, as follows

apt-key list //View all signatures,An expired signature was found
apt-key del 5072E1F5 //Delete expired signature//Reimport signature
apt-key adv --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
//Execute again
apt update

4. Install MySQL

apt install mysql-server

Then there are all kinds of error reporting trips, I will not count them one by one.

During the period from 9 o'clock last night to 1 o'clock in the morning, and then from 9 o'clock in the morning to 5 o'clock in the afternoon. I reset the virtual machine used for the test M times, encountered N problems, and solved N-1 problems.

In the end, I gave up. It was all lie.

Option II

The update fails, I can always reinstall it.

1. Backup

Backup database data

The utf8mb4 encoding is used here because emoji exists in the database

mysqldump -u root -p --default-character-set=utf8mb4 --all-databases > sql.sql

The backup database file is best to find a test 5.7 and import it to prevent problems

Backup configuration file

sudo tar zcvf mysql_config.tar.gz /etc/mysql/

2. Uninstall MySQL

View installed MySQL

dpkg -l | grep mysql

Uninstallation steps:

  1. sudo service mysql stop
  2. sudo apt remove mysql-server.
  3. sudo apt remove mysql-common
  4. sudo apt-get autoremove mysql. --purge

Recheck if there is still mysql related

dpkg -l | grep mysql

If the uninstallation is not complete, execute dpkg -l |grep ^rc|awk'{print $2}' |sudo xargs dpkg -P to clean up residual mysql files

3. Install MySQL5.7

# Download tar,Use domestic mirror,Will be faster
wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-server_5.7.25-1ubuntu14.04_amd64.deb-bundle.tar
# unzip
tar -xvf mysql-server_5.7.25-1ubuntu14.04_amd64.deb-bundle.tar
# start installation
sudo apt update
sudo dpkg -i mysql-common_5.7.25-1ubuntu14.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.25-1ubuntu14.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.25-1ubuntu14.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.25-1ubuntu14.04_amd64.deb
# The following step requires dependency
sudo apt install libaio1
sudo dpkg -i mysql-community-client_5.7.25-1ubuntu14.04_amd64.deb
sudo dpkg -i mysql-client_5.7.25-1ubuntu14.04_amd64.deb
sudo dpkg -i mysql-community-source_5.7.25-1ubuntu14.04_amd64.deb
# Installation dependencies
sudo apt install libmecab2
# This step will ask you to enter the password of the root user of the database
# The password entered here must be the same as the original one,Because the data will be restored later,Password will overwrite
sudo dpkg -i mysql-community-server_5.7.25-1ubuntu14.04_amd64.deb

Installation is complete, try to log in

service mysql start
# Version is 5.7,correct
mysql -u root -p

The installation is complete!!!

4. Import database data

# The first database file backed up
mysql -u root -p < sql.sql

Refer to the original configuration file, modify the current configuration file

5. carry out

I also stepped on a lot of pits during uninstallation and installation.The above steps are what I can finally use after experiments.

I have tested the above steps on the virtual machine for nearly 20 times, it should be a problem. Next, I can move the test environment. Let’s move on tomorrow, goodbye!!!

Recommended Posts

Ubuntu14 upgrade MySQL
Ubuntu16 upgrade Python3
ubuntu14.04.1 upgrade openssh
ubuntu16.04 upgrade python2
Install mysql under Ubuntu 16.04
How to upgrade to Ubuntu 20.04
Install mysql on Ubuntu 14.04
Ubuntu19 install MySQL pit
Ubuntu completely remove MySQL
Install MySQL under Ubuntu
How to upgrade to Ubuntu 20.04
Ubuntu completely uninstall mysql turn
Upgrade Ubuntu 18.04 on Azure to 18.10
Server upgrade Ubuntu 20.04 LTS record
Server upgrade Ubuntu 20.04 LTS record
How to upgrade to Ubuntu 16.04 LTS
How to install MySQL on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
Install and configure MySQL on Ubuntu
How to install mysql in Ubuntu 14.04
How to upgrade to PHP 7 on Ubuntu 14.04
MySQL connected to remote Ubuntu server
Ubuntu upgrade software and ubuntu upgrade system commands
How to install MySQL on Ubuntu 14.04
Steps to upgrade Laravel 5.4 to 5.6 in Ubuntu 16.04
ubuntu16.04 method steps to upgrade the kernel
Set UTF-8 encoding for MySQL5.7 in Ubuntu 16.04
Ubuntu software
A little experience using mysql on Ubuntu
Linux (ubuntu 12.04)
How to change MySQL password under Ubuntu
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
Remotely connect to MySQL database in Ubuntu environment
How to enable Mysql remote access under Ubuntu 14.04
How to install the latest MySQL on Ubuntu 18.04