Install MySQL5.1.73 On CentOS7
In this post we will see how we can configure and run MySQL5.1.73 version on CentOS7.
For this setup, we are using CentOS7, Updated as of April 2020.
Reasons for writing this post :- I head many times that we can’t install, configure and run MySQL5.1.73 version on CentOS7.
I tried it once and easily able to run this old MySQL Version on latest CentOS 7 machine as of now April 2020.
Below are the OS details which is using while working on this work
[root@srv60 ~]# cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core) [root@srv60 ~]# uname -r 3.10.0-1062.18.1.el7.x86_64
[root@srv60 ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.73 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Download MySQL Version
On CentOS7 is not provided with MYSQL5.1 version rpm. So we have to download tar-ball to run various required binaries from it.
Like in my scenario
# cd /opt # wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz # tar -xzvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz
This will create one directory that would could rename to MySQL5.1
[root@srv60 opt]# ls -ltrh total 128M -rw-r--r-- 1 root root 128M Nov 5 2013 mysql-5.1.73-linux-x86_64-glibc23.tar.gz drwxr-xr-x 13 root root 4.0K Apr 21 03:32 mysql5.1
MySQL configuration file
In MySQL instance we are using one configuration file that has various options used during MySQL instance.For this instance as well i created /etc/my.cnf file that has some options that would use later while we start MySQL.
[root@srv60 ~]# egrep -v "^$|^#" /etc/my.cnf [client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 syslog [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock basedir = /opt/mysql5.1 port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp
MySQL initial database
So now we have MySQL Dump tarball. Now we need to create initial database and run from it. To create it we have one script in this Dump, through this we can create initial database.
[root@srv60 mysql5.1]# scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/opt/mysql5.1
Above command would create initial database in database directory. This command was came some output like below.
[root@srv60 mysql5.1]# scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/opt/mysql5.1 Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /opt/mysql5.1/bin/mysqladmin -u root password 'new-password' /opt/mysql5.1/bin/mysqladmin -u root -h srv60.geekpills.com password 'new-password' Alternatively you can run: /opt/mysql5.1/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /opt/mysql5.1 ; /opt/mysql5.1/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /opt/mysql5.1/mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/mysql5.1/scripts/mysqlbug script!
Start MySQL instance
Now we could start MySQL instance with simple commands mentioned above in output. We can also set MySQL root password.
[root@srv60 mysql5.1]# /opt/mysql5.1/bin/mysqladmin -u root password 'passw0rd'
Now we could start MySQL instance like below
[root@srv60 ~]# cd /opt/mysql5.1 ; /opt/mysql5.1/bin/mysqld_safe &  2215 [root@srv60 mysql5.1]# 200423 17:38:58 mysqld_safe Logging to syslog. 200423 17:38:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Now we can connect this database with same password mentioned above.
[root@srv60 mysql5.1]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.1.73 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]>
In above mentioned steps , now we know how to configure MySQL5.1.73 version on CentOS7. We could also create systemctl service file for this MySQL instance, will cover in next post of it.