30

I searched a tutorial for dummies, about how to Update my MySQL 5.5 Server to MySQL 5.7 I'm Using ubuntu 14.04. I've already tried the tutorials on the MySQL Website. How can I upgrade my server?

David
  • 3,367
Cgnkev
  • 311
  • 1
  • 4
  • 7
  • MySQL docs says: "Upgrading more than one release level is supported, but only if you upgrade one release level at a time. For example, upgrade from 5.1 to 5.5, and then to 5.6. Follow the upgrade instructions for each release, in succession."

    so you should doing update in two steps 5.5 -> 5.6 -> 5.7

    – iterq Apr 24 '17 at 16:11

3 Answers3

75

This worked for me:

wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo gdebi mysql-apt-config_0.8.10-1_all.deb
sudo apt-get update
sudo apt-get install mysql-server

The 2nd command will ask for input:

enter image description here

After picking 5.7 choose "apply"


$ mysql --version
mysql  Ver 14.14 Distrib 5.7.8-rc, for Linux (x86_64) using  EditLine wrapper

Don' forget to run mysql_upgrade after installation to upgrade system tables and restart server, following MySQL Upgrading guide.

$ mysql_upgrade

or

$ sudo mysql_upgrade -u root -p

And restart mysql

sudo service mysql restart
Rinzwind
  • 299,756
  • 1
    I have upgraded my mysql using this method but it broked my apache2 , now i am receiving 500 across all my hosted sites . http://askubuntu.com/questions/795868/ah00051-child-pid-xxxxx-exit-signal-segmentation-fault-11-possible-coredump – Rahul K Jha Jul 07 '16 at 08:05
  • 1
    I think the new version deb link is: http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb – zx1986 Oct 09 '16 at 13:16
  • 4
    Note that sudo mysql_upgrade -u root -p is required!! – Jadeye Dec 20 '16 at 10:22
  • 2
    The wget parameter url is going to continue changing as new versions are released. Go here https://dev.mysql.com/downloads/repo/apt/ and check the bottom of the page – Gerbus Feb 26 '17 at 18:32
  • Also don't forget sudo service mysql restart – Gerbus Feb 26 '17 at 19:27
  • 1
    how do i choose "apply" ... i press enter and it takes me same step again and againa – Umair Ayub Apr 21 '17 at 14:25
  • If you see GPG KEYEXPIRED error on apt-get update, try this https://askubuntu.com/questions/884798/why-mysql-repository-key-suddenly-expired?newreg=c11407b2e40247faa443158c7b119268 – j-bin Oct 29 '17 at 12:33
  • Tried this and on mysql_upgrade received "already on newest version", and I have 5.5 not 5.7. – Pablo Pazos Aug 30 '19 at 05:56
28

You can see my comment that the solution by @Rinzwind did not worked in my case (Ubuntu 14.04 , Mysql 5.5). So i have googled the solution and found the answer which worked for me at Digital Ocean Tutorial.

First of all , Backup All your Database.

mysqldump --all-databases > all_databases.sql

If above command did not work for you try below one.

mysqldump -u root -p --all-databases > all_databases.sql

I am pasting the particular portion of tutorial that worked for me .

If you want to install MySQL 5.7, you'll need to add the newer APT package repository from the MySQL APT repository page. Click Download on the bottom right, then copy the link on the next page from No thanks, just start my download. Download the .deb package to your server.

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

Next, install it using dpkg.

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

You'll see a prompt that asks you which MySQL product you want to configure. The MySQL Server option, which is highlighted, should say mysql-5.7. If it doesn't, press ENTER, then scroll down to mysql-5.7 using the arrow keys, and press ENTER again.

Once the option says mysql-5.7, scroll down on the main menu to Apply and press ENTER again. Now, update your package index.

sudo apt-get update

Finally, install the MySQL-server package, which now contains MySQL 5.7.

sudo apt-get install mysql-server

Now upgrade all mysql databases .

sudo mysql_upgrade -u root -p

Now restart mysql server .

sudo service mysql restart

Always find the latest version of mysql-at-config file at https://dev.mysql.com/downloads/repo/apt/

Rahul K Jha
  • 1,018
  • 2
    I'm getting the following error during mysql-server installation :W: GPG error: http://repo.mysql.com trusty InRelease: The following signatures were invalid: KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 – Snigdha Batra Jul 14 '17 at 10:22
  • 3
    @SnigdhaBatra , It is a known bug . Use command sudo apt-key adv --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 to solve your issue. – Rahul K Jha Jul 15 '17 at 21:55
  • I get that the key A4A9~ can't be retrieved, so nothing happens – Lucas Bustamante Aug 23 '18 at 16:30
  • Which Ubuntu version are you using? – Rahul K Jha Aug 23 '18 at 16:31
  • 14.04 - I was eventually able to solve it by going to the "bug" URL you provided and trying a few things there. I don't remember now what it was. – Lucas Bustamante Aug 28 '18 at 20:07
  • @LucasBustamante I'm glad it helped. – Rahul K Jha Aug 29 '18 at 20:24
  • 1
    Fwiw, in order to back up all databases I had to also specify a user to mysqldump (as per this answer). eg: mysqldump -u root -p --all-databases > alldb.sql – Nick F Jan 07 '19 at 16:59
  • Tried this and on mysql_upgrade received "already on newest version", and I have 5.5 not 5.7. Uninstalled 5.5 and sudo apt-get install mysql-server tries to install 5.5 again, no 5.7 options. – Pablo Pazos Aug 30 '19 at 05:57
3

this can also happen when upgrading from 14.04 to 16.04, which causes an unsupported mysql upgrade (5.5 -> 5.7), which is not a supported upgrade path as documented by mysql. The easiest way around this is to upgrade mysql to 5.6 whilst still under 14.04. You achieve this by first (of course!) dumping all your databases;

hostname # mysqldump --lock-all-tables -u root -p --all-databases > backup.sql

then upgrading to mysql 5.6;

hostname # apt-get install mysql-server-5.6 mysql-client-5.6 mysql-server-core-5.6 mysql-client-core-5.6

This way, all your databases are upgraded in place and (on my machines so far) entirely safely and transparently to 5.6. The only issue after the upgrade may be TIMESTAMP entries. Now, even after an do-release-upgrade to 16.04, mysql is still left at 5.6 and the issues surrounding the non-supported upgrade from 5.5 directly to 5.7 during the release upgrade never even surface.

Hope this helps,

Kailee.

Kailee
  • 81