The MySQL APT Repository gives you an easy and simple way to update or install the latest MySQL products and software using Apt.
If you are using Debian 7 (Wheezy), Ubuntu – 12.04 Long Term Support (Precise Pangolin) or Ubuntu – 14.04 Long Term Support (Trusty Tahr), then you can use the APT repository to install or update MySQL 5.6 General Availability or MySQL 5.7 Development Release.
A quick reminder, though: the service is still in development release, so there might be inconsistencies or bugs while using it.
Fresh MySQL Installation
If your system has no previous versions of MySQL installed, then you can use MySQL APT Repository for a fresh install. This is pretty straightforward; all you have to do is go to the MySQL APT Repository page and then download the release package that you want.
[expand title=”Click here to read more about this article”]
To install the downloaded package:
shell> sudo dpkg -i /PATH/(name of the package you downloaded).deb
For instance, if you are installing version 1.5 of MySQL for Ubuntu 14.04 LTS, you would need to enter
shell> sudo dpkg -i mysql-apt-config_0.1.5-1ubuntu14.04_all.deb
You can choose between MySQL 5.6 and 5.7 via a dialogue box that appears during installation.
Then you should enter shell> sudo apt-get update to get the latest package information from the APT repository.
From hereon, you could install MySQL using this command:
shell> sudo apt-get install mysql-server
You would be asked to supply a password for your root user. You will also be asked if you want to install a test database on your system.
After these, you can now start or stop your MySQL server using the shell> sudo service mysql stop or shell> sudo service mysql start command.
You can also use MySQL APT Repository to install other MySQL components and products on your system, as well as installing the source code for MySQL and build it for your own use.
Upgrade your MySQL using MySQL APT Repository
If you want to upgrade your MySQL version, you must first back your database up. You can only upgrade your MySQL using MySQL APT Repository if you have installed it using the repository.
MySQL APT Repository allows you to update your old MySQL files and then letting the new version run using the old data files.
Replacing your MySQL
If you do have MySQL versions, whether it is distributed by Oracle or third parties, then you could choose to replace your native MySQL distribution. This also applies to MySQL versions that were not installed using the MySQL APT Repository.
If you are replacing your MySQL using the MySQL APT Repository, you need to remember that you cannot do this if your current MySQL version came from a non-native repository, such as Percona or MariaDB. In cases such as this, you would need to uninstall your current MySQL versions before replacing it.
To replace your MySQL version using MySQL APT Repository, you need to back up your database first to ensure that there is no data loss. Then you need to add the MySQL APT Repository to your repository list and then choose the release series you want to install. You can now replace your native MySQL when you upgrade your MySQL packages via the MySQL APT Repository.
If you installed your MySQL server using a direct deb package download, you would need to backup your database then add MySQL APT Repository to your repository list. Then you would need to remove the old version and install MySQL using the MySQL APT Repository.
Want to know more about using the MySQL APT Repository? Call Four Cornerstone today!
Screenshot courtesy of MySQL.[/expand]