Pak Jiddat - Innovative Software Services

Read: In the name of thy Lord Who createth, Createth man from a clot. Read: And thy Lord is the Most Bounteous, Who teacheth by the pen, Teacheth man that which he knew not. Nay, but verily man is rebellious That he thinketh himself independent!. Lo! unto thy Lord is the return. (Sura Alalaq 96:8)

Upgrading MySQL server from version 5.6 to 8.0

Created On: 28 Jun, 2018: 16:04:08 - Tags : server management | software installation | database management

Url: https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

The latest version of MySQL server currently is 8.03. To upgrade MySQL server from a previous version we need to ensure that we are upgrading from the last stable release. For example from version 5.7 to 8.0. To upgrade from 5.6 to 8.0 we need to first upgrade from 5.6 to 5.7 and then from 5.7 to 8.0. Upgrading directly from 5.6 to 8.0, will result in errors related to incompatible sql or log file formats.

Installing latest version of MySQL server

MySQL server is part of most Linux distributions. However the default version of MySQL server is usually outdated. We can install the latest version of MySQL server from the MySQL apt repository. The MySQL online documentation provides detailed information on how to install and upgrade MySQL server and tools using the MySQL apt repository.

To install the MySQL apt repository we need to first download the repository package from: http://dev.mysql.com/downloads/repo/apt/. Next we need to install the repository package using the command: sudo dpkg -i mysql-apt-config_w.x.y-z_all.deb. During the installation of the package, we will be asked to choose the version of MySQL server and other tools. After the repository package has been installed we can install the MySQL server using the commands: apt-get update followed by apt-get install mysql-server. This will install the version of the MySQL server that we had selected during the repository package installation.

To change the version of MySQL server that we have installed, we need to issue the command: sudo dpkg-reconfigure mysql-apt-config. The version that we select here will be installed when we install the package from apt

Upgrading MySQL server

As mentioned previously we should upgrade to the next stable release. For example from 5.6 to 5.7. To upgrade MySQL server we should first back up the database. We can do this by exporting the databases to sql file using the command: mysqldump -u root -p --all-databases > database_file.sql. This command will export all databases to a sql file. We may also back up the data directory located at: /var/lib/mysql.

Next we need to remove the MySQL server using the command: apt-get remove mysql-server. This command will remove the MySQL server binaries from the system. To remove the MySQL data we need to substitute remove with purge in the previous command.

After that we need to choose the new version of MySQL server from the MySQl apt configuration tool. We can access the tool with the command: sudo dpkg-reconfigure mysql-apt-config.

Next we need to install the new version of the MySQL server with the command: apt-get install mysql-server. During installation we will be prompted for the root password for the MySQL server.

If we had used the purge option while removing the MySQL server, then we will need to import the data back to the MySQL server. We can do this with the command: mysql -u root -p < database_file.sql

After the installation has completed we need to upgrade the server using the command: mysql_upgrade -u root -p. This will upgrade the table formats to the version support by the new MySQL server.

Downgrading MySQL server

To downgrade MySQL server to a previous version, we need to follow the same procedure that we used for upgrading the server. The only change would be to select the older MySQL server version from the MySQL apt configuration tool

Related Articles

  1. Using Rsync over custom SSH port
  2. Upgrading Postgresql from version 9.4 to 9.6
  3. Installing latest version of Php
  4. Upgrading R from version 3.0 to 3.5
  5. Backing up and restoring LXD containers
  6. Resizing Linux root partitions without unmount on Google Cloud
  7. Running multiple versions of mailx command
  8. Getting /etc/rc.local file to work on Debian 9 (Stretch)
  9. Increasing number of concurrent connections for Proftp
  10. Changing ownership of symbolic link
  11. Configuring Apache to process html files as php
  12. Php server APIs
  13. Apache Multi Processing Modules (MPMs)
  14. Calculating the number of simultaneous connections supported by Apache
  15. Problem with copying large files to USB
  16. Monitoring RAM usage on server
  17. Finding CPU usage using top command
  18. Format of crontab file
  19. Force grub2 to not use UUID
  20. Automate scp command using sshpass
  21. Using PSCP command for copying files and directories
  22. Installing Docker on Debian Jessie
  23. Rocket Chat migration error
  24. Rocket Chat startup script
  25. Upgrading Rocket Chat to latest version
  26. Installing modules in Odoo 10.0
  27. Installing NodeJS on Ubuntu
  28. Installing W3C Markup Validator on Debian Jessie
  29. Ignoring errors during MySQL import
  30. MariaDB/MySQL user password not being set
  31. Sorting a MySQL string column as a number
  32. MySQL server out of resources
  33. MySQL Tuner
  34. Create backup of Mongo Db database
  35. Deleting a Mongo Db database
  36. Restoring a database backup in Plesk
  37. How to login to MySQL server as root user on Plesk
  38. List all databases for Postgresql
  39. Solution for mysql header mismatch error
  40. Backing up and Restoring MongoDB data
  41. Removing Replication in MongoDb
  42. Exporting Mysql database data in CSV format using Mysql Work Bench