How-To: Install Older Version of MySQL on Debian-Based Systems
By Bo Lechnowsky, CEO of ameriDroid.com:
MySQL is a very popular database used on servers, as well as single board computers, like the ODROID-H2+ and ODROID-HC4, for a variety of reasons. We use MySQL here at ameriDroid.com to run our back-end office database systems, presently on the ODROID-H2+ and ODROID-HC1.
Generally, it is difficult to find information on how to install an older version of MySQL. Sometimes, an older version of MySQL is required for compatibility with other software.
As of the writing of this article (October 2020), the following steps worked to install MySQL 5.5.62 on Linux Mint x86/x64:
cd /usr/local |
The location where MySQL should be installed |
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz |
If this returns an error, it is because this file has been moved or removed from MySQL's site (use a web browser to find the archived files on the MySQL site and copy the link to the version you want) |
groupadd mysql |
If this returns an error, this step wasn't needed |
useradd -g mysql mysql |
If this returns an error, this step wasn't needed |
tar -xvf mysql*.tar.gz |
Extracts MySQL into the current directory |
rm mysql-*.gz |
Removes the compressed file that is no longer needed |
mv mysql-* mysql |
Renames the long MySQL directory name to the short version |
chown root:root mysql |
Changes the permissions on the mysql directory to the correct permissions |
cd mysql |
Goes into the mysql directory |
chown -R mysql:mysql * |
Changes permissions on all the files in the mysql directory to the mysql user and the mysql group |
apt install libaio1 |
May already be installed, but just to make sure |
scripts/mysql_install_db --user=mysql |
Installs MySQL |
chown -R root . |
Changes permissions on the files in the MySQL directory |
chown -R mysql data |
Changes permissions on the MySQL data directory |
cp support-files/my-medium.cnf /etc/my.cnf |
Copies the configuration file to the correct location |
bin/mysqld_safe --user=mysql & cp support-files/mysql.server /etc/init.d/mysql.server |
Starts MySQL server and copies the autostart file to the correct location |
bin/mysqladmin -u root password 'pswd' |
Change 'pswd' to the MySQL root password - This will be referred to as the MySQL root password from now on |
/etc/init.d/mysql.server start |
Starts MySQL server |
/etc/init.d/mysql.server stop |
Stops MySQL server |
update-rc.d -f mysql.server defaults |
Enables MySQL to start when computer is rebooted |
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql |
Adds MySQL to the system path |
apt install libncursesw5 |
Installs a library needed by MySQL |
At this point, after a reboot, the desired version of MySQL should automatically be running. A new database can be created, or a mysqldump
backup file can be restored to this MySQL instance.
Comments
Leave a comment