How to Install MySQL Database Server Manually in Linux Ubuntu 19.10 Operating System

Posted on

Introduction

This article is an article where the main focus is just to explain about how to install MySQL Database Server manually. The installation process is done in Linux Ubuntu 19.10 operating system. The installation of MySQL Database Server in a manual way exist in three sections. The first one is only giving the step for getting the actual installer file of MySQL Database Server. The second one is mainly giving the proper step for installing that installer file manually. And finally the last one is the execution of MySQL Database Server.

The preparation for MySQL Database Server Manual Installation

The first section, the one for preparing MySQL Database Server manual installation is very simple. Just follow the steps below :

1. Access the MySQL Database Server’s tarbal source file in the following link. The link will display the download page for MySQL Database Server’s file installer. There are several types of installer according to the operating system. In this article, the installation will use the previous version of MySQL Database Server. Just click the link that will direct to another page providing the installer for the previous version of MySQL Database Server. The page itself exist as in the following image :

How to Install MySQL Database Server Manually in Linux Ubuntu 19.10 Operating System
How to Install MySQL Database Server Manually in Linux Ubuntu 19.10 Operating System

The following is the page previewing the previous version of MySQL Database Server after clicking the link ‘Looking for previous GA versions?’ :

How to Install MySQL Database Server Manually in Linux Ubuntu 19.10 Operating System
How to Install MySQL Database Server Manually in Linux Ubuntu 19.10 Operating System

2. The next step is for the extraction of the MySQL Database Server’s source file installer into a certain location. Just extract the file where in this context it is mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz. For an example, the extraction will be in ‘/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64’ folder.

That is all for the preparation step. The next section will cover the main steps for the actual installation.

 

The main step for MySQL Database Server Manual Installation

Continue on the previous section, the following will be the actual step for the manual installation. Those step are in the following sequence :

1. After extracting the files into the specific location. Just copy the initialization script file from the folder with the name of ‘/support-files/mysql.server’ into ‘/etc/init.d’. Just name the file into an easy one and it will help for further recognition. For an example, the will will have a name of ‘mysqld57’. So, the following is the exact process :

cp /opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/support-files/mysql.server /etc/init.d/mysqld57

2. Edit the initialization script file by modifying the following lines :

basedir=
datadir=

Into the following line of configuration :

basedir=/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64
datadir=/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/data

3. Don’t forget to execute the command ‘update-rc.d’ because it is in Linux Ubuntu distribution. It is the exact same function with the ‘chkconfig’ command. According to the manual page of update-rc.d, the command will install and remove System-V style init script links. The following is the command execution of update-rc.d to install the service mysqld57 :

root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin# update-rc.d mysqld57 defaults
root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin# 

4. The next step, execute the following command to generate the data directory of the MySQL Database Server. Do it as the following command :

root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin# ./mysql_install_db --user=mysql --datadir=/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/data
2020-01-03 15:03:09 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2020-01-03 15:03:39 [WARNING] select() timed out.
root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin# 

5. Don’t forget to create a new MySQL Database configuration file. Just create a new one with the name of ‘my.cnf’ in the main installation source file. So, the full path location of the file is ‘/opt/mysql/temp/mysql-5.7.28-linux-glic2.12-x86_64/my.cnf’. Edit the file and insert the following line configurations :

root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin# update-rc.d mysqld57 defaults
root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin# 

1. Before starting MySQL Database Server, check the status of the MySQL Database Server’s service. Use the service name from the step in the third step.

The next step, execute the following command to generate the data directory of the MySQL Database Server. Do it as the following command :

[mysql]
port=3377
socket=/tmp/mysqld57.sock

[mysqld]
port=3377
socket=/tmp/mysqld57.sock
datadir=/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/data

Save the file above and the main step of the installation is actually done. Just continue on to the next section for running MySQL Database Server.

 

Running MySQL Database Server

This section will focus on how to run MySQL Database Server. Just do the following step.

1. First of all, check the status of the MySQL Database Server’s service. Execute the following command :

Start the service. In the previous section, the service name for MySQL Database Server is ‘mysqld57’. So, the actual process for running the service will in the following execution :

root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64# service mysqld57 status
● mysqld57.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/init.d/mysqld57; generated)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)
root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64# 

As it is exist in the above output, currently the service is not running.

2. After that, start the service. In the previous section, the service name for MySQL Database Server is ‘mysqld57’. So, the actual process for running the service will in the following execution :

root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64# service mysqld57 start
root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64# 

3. Recheck the status of the service again. Start the service. In the previous section, the service name for MySQL Database Server is ‘mysqld57’. So, the actual process for running the service will in the following execution :

root@hostname:/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64$ service mysqld57-3 status
● mysqld57.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/init.d/mysqld57; generated)
   Active: active (running) since Tue 2020-01-07 22:15:54; 1 day 9h ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 28 (limit: 4915)
   Memory: 159.7M
   CGroup: /system.slice/mysqld57-3.service
           ├─18328 /bin/sh /opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin/mysqld_safe --datadir=/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/data --pid-file=/opt/mysql/temp/
           └─18530 /opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin/mysqld --basedir=/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64 --datadir=/opt/mysql/temp/mysql-5.7.28-linux-

Jan 07 22:15:51 hostname systemd[1]: Starting LSB: start and stop MySQL...
Jan 07 22:15:51 hostname mysqld57-3[18307]: Starting MySQL
Jan 07 22:15:54 hostname mysqld57-3[18307]: ... *
Jan 07 22:15:54 hostname systemd[1]: Started LSB: start and stop MySQL.
root@hostname:/opt/mysql/tested/mysql-5.7.28-linux-glibc2.12-x86_64$ 

Finally, the service of MySQL Database Server is running. But this installation still have an issue on the setting of the initial password of the root database. The explanation on the trick for configuring the initial password for the root database will be available in the other article. The article is available in this link. That article has a title of ‘How to Configure and Set root password of a MySQL Database Server Manual Installation for the first time’.

Leave a Reply