MySQL installation using generic binaries-UNIX Platform.
In this article we will come to know install MySQL using generic binaries.
Learning Objectives :
- Choose the proper type of MySQL server software distribution.
- Get an overview of MySQL installation tasks.
- Load time zone tables.
- Start and Stop the MySQL server.
- Upgrade MySQL.
MySQL Binary Distribution
- Available for several operating systems.
- Precompiled programs.
- Windows
– Essentials
– Complete with Configuration Wizard
– No-install
- Linux
– RPM files
– Tar files
- See website for more specific packages .
– https://dev.mysql.com/downloads/mysql/
Advantage with Binary Distribution
- Good selecting config options
- High quality commercial compilers
- Provided with extensive libraries
Installing MySQL using generic binaries
(Specific for Linux OS and need to do manual configurations it means you need to create your directories, users, assign roles and privileges to users before start installation.)
Note: Using binary distribution you can install older versions or release candidates as well
You can download binaries from https://dev.mysql.com/downloads/mysql/
In above picture click on Looking for previous GA versions option on Right side.
This option will used to install previous version of MYSQL.
Need to choose on which operating system we are installing .
Here we are installing 5.7.24 version of MySQL on Linux servers.
Now copy the link of of MySQL and paste in Ubuntu server and write wget at starting .
It will download by connecting Google link.
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
File is downloaded.
Note: You can get configuration steps from https://dev.mysql.com/doc/refman/5.6/en/binary-installation.html
As shown above it requires dependency packages lets install first.
1 2 3 4 |
root@ip-172-31-11-162:~# apt-cache search libaio libaio-dev - Linux kernel AIO access library - development files libaio1 - Linux kernel AIO access library - shared library libaio1-dbg - Linux kernel AIO access library - debugging symbols |
Below command is to download basic update for libaio package.
Installing libaio1 package
As mentioned above we need to create all necessary users and groups using below commands.
Step by step installation .
1 2 3 4 5 6 7 8 9 |
root@ip-172-31-11-162:~# groupadd mysql root@ip-172-31-11-162:~# useradd -r -g mysql -s /bin/false mysql root@ip-172-31-11-162:~# ls -la mysql* -rw-r--r-- 1 root root 198993245 Aug 28 19:38 <span style="color: #0000ff;">mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz</span> root@ip-172-31-11-162:~# cd /usr/local root@ip-172-31-11-162:/usr/local# pwd /usr/local root@ip-172-31-11-162:/usr/local# root@ip-172-31-11-162:/usr/local# |
Extracting downloaded MySQL file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
root@ip-172-31-11-162:/usr/local# tar -xzvf /root/mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/test-ATIS mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/test-select mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/crash-me mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/test-wisconsin mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/innotest1b mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/innotest2a mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/innotest1 mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/test-create mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/bench-count-distinct mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/sybase.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/ms-sql.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/mysql-4.1.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/empress.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/msql.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/interbase-superserver.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/oracle.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/mimer.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/interbase.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/mysql.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/frontbase.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/mysql-3.22.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/db2.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/mysql-4.0.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/Informix.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/solid.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/Adabas.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/pg.cfg mysql-5.5.62-linux-glibc2.12-x86_64/sql-bench/limits/access_odbc.cfg |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
root@ip-172-31-11-162:/usr/local# ls -la total 44 drwxr-xr-x 11 root root 4096 Oct 23 14:10 . drwxr-xr-x 10 root root 4096 Sep 12 13:38 .. drwxr-xr-x 2 root root 4096 Sep 12 13:38 bin drwxr-xr-x 2 root root 4096 Sep 12 13:38 etc drwxr-xr-x 2 root root 4096 Sep 12 13:38 games drwxr-xr-x 2 root root 4096 Sep 12 13:38 include drwxr-xr-x 3 root root 4096 Sep 12 13:39 lib lrwxrwxrwx 1 root root 9 Sep 12 13:38 man -> share/man drwxr-xr-x 13 root root 4096 Oct 23 14:10<span style="color: #0000ff;"> mysql-5.5.62-linux-glibc2.12-x86_64</span> drwxr-xr-x 2 root root 4096 Sep 12 13:38 sbin drwxr-xr-x 6 root root 4096 Sep 12 13:40 share drwxr-xr-x 2 root root 4096 Sep 12 13:38 src |
Next step we are creating symbolic link to above highlighted folder in BLUE.
Go to mysql directory and list out the files.
Go to scripts folder you will see mysql_install_db this is the script which will initialize and create default MySQL database and basis user information.
1 2 3 4 5 6 7 |
root@ip-172-31-11-162:/usr/local/mysql# cd scripts root@ip-172-31-11-162:/usr/local/mysql/scripts# ls -la total 24 drwxr-xr-x 2 root root 4096 Oct 23 14:10 . drwxr-xr-x 13 root root 4096 Oct 23 14:10 .. -rwxr-xr-x 1 7161 31415 14764 Aug 28 21:36<span style="color: #0000ff;"> mysql_install_db</span> root@ip-172-31-11-162:/usr/local/mysql/scripts# |
In below command we are using – -user=mysql this is the same user which we create earlier.
Once script execution completed check for errors, if any errors found you need to fix those errors to proceed further.
Below step we are executing mysqld_safe script as mysql user in background, mysqld_safe in bin folder actually initializes MySQL server, and this actually calls mysqld process.
Next step we are copying mysql.server file to /etc/init.d folder this will enable you start/stop from mysql folder itself in other words when ever server boots/restart it will directly go to init.d and check and start MySQL accordingly, if this step is not performed above step need to execute manually every time we restart MySQL.
Let’s go to bin directory in this we have all scripts in those scripts mysql script is available, this script will enable to connect MySQL we can directly connect because we don’t have any password yet.
Now run mysql using ./mysql
To check databases locations.
As shown below no password is set by default.
We need to export path as shown below to access this path (files/scripts under /usr/local/mysql/bin) from any location.
My.cnf file is necessary to start/stop mysql database by default this file won’t be there we need to create it manually navigate to /usr/local/mysql/support_files
Copy my-default.cnf file from /usr/local/mysql/support-files to /etc as my.cnf file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
root@ip-172-31-11-162:/usr/local/mysql/support-files# ll total 104 drwxr-xr-x 2 root root 4096 Oct 23 14:10 ./ drwxr-xr-x 13 root root 4096 Oct 23 14:10 ../ -rwxr-xr-x 1 7161 31415 1153 Aug 28 21:36 binary-configure* -rw-r--r-- 1 7161 31415 4528 Aug 28 21:36 config.huge.ini -rw-r--r-- 1 7161 31415 2382 Aug 28 21:36 config.medium.ini -rw-r--r-- 1 7161 31415 1626 Aug 28 21:36 config.small.ini -rw-r--r-- 1 7161 31415 773 Aug 28 21:12 magic -rw-r--r-- 1 7161 31415 4691 Aug 28 21:36 my-huge.cnf -rw-r--r-- 1 7161 31415 19759 Aug 28 21:36 my-innodb-heavy-4G.cnf -rw-r--r-- 1 7161 31415 4665 Aug 28 21:36 my-large.cnf -rw-r--r-- 1 7161 31415 4676 Aug 28 21:36 my-medium.cnf -rw-r--r-- 1 7161 31415 2840 Aug 28 21:36 my-small.cnf -rwxr-xr-x 1 7161 31415 1061 Aug 28 21:36 mysqld_multi.server* -rwxr-xr-x 1 7161 31415 839 Aug 28 21:36 mysql-log-rotate* -rwxr-xr-x 1 7161 31415 10565 Aug 28 21:36 mysql.server* -rw-r--r-- 1 7161 31415 1326 Aug 28 21:36 ndb-config-2-node.ini |
copy the my-huge.cnf to /etc with the name of my.cnf
1 |
root@ip-172-31-11-162:/usr/local/mysql/support-files# cp my-huge.cnf /etc/my.cnf |
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform