MySQL/Percona Custom Installation using tar.gz(precompiled binaries) files / Setting up multiple versions of MySQL DB instances on a single server.
Through this post, I would like to walk you through MySQL custom installation using tar.gz(precompiled binaries) files.
This post will give an idea of how to do custom installation of either MySQL/Percona/MariaDB.
And also it will help you to setup/configure multiple Versions of either MySQL/Percona/MariaDB servers on a single server.
Follow the listed steps below to setup either single or multiple version of MySQL software on a single server.
STEP1 : As usual we have to create a group and a user for MySQL, just create it by following these steps, please ignore if you have already created a user and group for MySQL.
For easy understanding, I am choosing mysqldba as group and mysql as user.
A) groupadd mysqldba
B) useradd mysql -d “/customlocationpath” -g mysqldba
EX : useradd mysql -d “/home/users/mysql” -g mysqldba
NOTE : Based on operating sytem/standardization/your needs, you have to take care of certain extra steps from the STEP1.
STEP2 : Download the required version of software based on your needs.
STEP3 : Choose and create a directory for software and for data directory.
A) For software installation I am choosing “/opt/product/mysql”.
mkdir -p /opt/product/mysql
chown -R mysql:mysqldba /opt/product/mysql
chmod -R 750 /opt/product/mysql
B) For data directory I am going with “/data/mysql”.
mkdir -p /data/mysql
chown -R mysql:mysqldba /data/mysql
chmod -R 700 /data/mysql
STEP4 : Software installation, make sure the following steps you will be running as a mysql user.
NOTE : To show a demo on installation, I am going with the installation of MySQL5.6.21 version, the following steps(commands) will change based on MySQL version.
cd /opt/product/mysql
tar -zxvf “/home/trimurthy/Downloads/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz” .
mv mysql-5.6.21-linux-glibc2.5-x86_64 mysql5621
Now MySQL5.6.21 base directory is /opt/product/mysql/mysql5621
STEP5 : Prepare a configuration file based on the chosen software/data directories.
NOTE : Add the following extra configuration parameters to your MySQL config file.
[mysqld_multi]
mysqld = /opt/product/mysql/mysql5621/bin/mysqld_safe
mysqladmin=/opt/product/mysql/mysql5621/bin/mysqladmin
user=usertoshutdown // this user is to shutdown the mysql server.
In your configuration file make sure you are using [mysqldportno] instead of just [mysqld], because we will be using mysqld_multi to start and stop the MySQL DB Instances.
Ex : if your port no is 3326 replace [mysqld] with [mysqld3326] in your configuration file.
STEP6 : MySQL Instance installation/DB installation.
NOTE : Before start the installation process make sure you have created all the required directories mentioned in the configuration file.
set the path to version bin location of the MySQL version.
EX : export PATH=/opt/product/mysql/mysql5621/bin:$PATH
Install/configure the Instance with the following command.
mysql_install_db --defaults-file=/data/mysql/configfiles/mysql_3326.cnf --user=mysql --basedir=/opt/product/mysql/mysql5621/ --datadir=/data/mysql/var/lib/mysql/
Make sure the installation/configuration of instance is success.
STEP7 : Start the MySQL instance by using the following commands.
NOTE : make sure you have set the path to right version of MySQL.
To start MySQL instance.
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf start 3326
Login to the DB and do the cleanup of anonymous users cleanup and set the password for the root users / run MySQL secure installation.
Go through Link for more information.
Use the following command to check the status,start and stop the MySQL instance.
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf report 3326
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf start 3326
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf stop 3326
Please feel free to comment/reachme if you have any quesions regarding this installation.
MySQL Internals, MySQL HighAvailability, MySQL Performance Tuning, MySQL Query Optimization, MySQL performance, MySQL Fabric, MySQL HA, MySQL Installation, MySQL Upgrade, InnoDB Performance Tuning, InnoDB Buffer Pool Size, MySQL Performance Tuning, MySQL ClusterMySQL Latest News, News and Events, MySQL Customers
Through this post, I would like to walk you through MySQL custom installation using tar.gz(precompiled binaries) files.
This post will give an idea of how to do custom installation of either MySQL/Percona/MariaDB.
And also it will help you to setup/configure multiple Versions of either MySQL/Percona/MariaDB servers on a single server.
Follow the listed steps below to setup either single or multiple version of MySQL software on a single server.
STEP1 : As usual we have to create a group and a user for MySQL, just create it by following these steps, please ignore if you have already created a user and group for MySQL.
For easy understanding, I am choosing mysqldba as group and mysql as user.
A) groupadd mysqldba
B) useradd mysql -d “/customlocationpath” -g mysqldba
EX : useradd mysql -d “/home/users/mysql” -g mysqldba
NOTE : Based on operating sytem/standardization/your needs, you have to take care of certain extra steps from the STEP1.
STEP2 : Download the required version of software based on your needs.
STEP3 : Choose and create a directory for software and for data directory.
A) For software installation I am choosing “/opt/product/mysql”.
mkdir -p /opt/product/mysql
chown -R mysql:mysqldba /opt/product/mysql
chmod -R 750 /opt/product/mysql
B) For data directory I am going with “/data/mysql”.
mkdir -p /data/mysql
chown -R mysql:mysqldba /data/mysql
chmod -R 700 /data/mysql
STEP4 : Software installation, make sure the following steps you will be running as a mysql user.
NOTE : To show a demo on installation, I am going with the installation of MySQL5.6.21 version, the following steps(commands) will change based on MySQL version.
cd /opt/product/mysql
tar -zxvf “/home/trimurthy/Downloads/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz” .
mv mysql-5.6.21-linux-glibc2.5-x86_64 mysql5621
Now MySQL5.6.21 base directory is /opt/product/mysql/mysql5621
STEP5 : Prepare a configuration file based on the chosen software/data directories.
NOTE : Add the following extra configuration parameters to your MySQL config file.
[mysqld_multi]
mysqld = /opt/product/mysql/mysql5621/bin/mysqld_safe
mysqladmin=/opt/product/mysql/mysql5621/bin/mysqladmin
user=usertoshutdown // this user is to shutdown the mysql server.
In your configuration file make sure you are using [mysqldportno] instead of just [mysqld], because we will be using mysqld_multi to start and stop the MySQL DB Instances.
Ex : if your port no is 3326 replace [mysqld] with [mysqld3326] in your configuration file.
STEP6 : MySQL Instance installation/DB installation.
NOTE : Before start the installation process make sure you have created all the required directories mentioned in the configuration file.
set the path to version bin location of the MySQL version.
EX : export PATH=/opt/product/mysql/mysql5621/bin:$PATH
Install/configure the Instance with the following command.
mysql_install_db --defaults-file=/data/mysql/configfiles/mysql_3326.cnf --user=mysql --basedir=/opt/product/mysql/mysql5621/ --datadir=/data/mysql/var/lib/mysql/
Make sure the installation/configuration of instance is success.
STEP7 : Start the MySQL instance by using the following commands.
NOTE : make sure you have set the path to right version of MySQL.
To start MySQL instance.
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf start 3326
Login to the DB and do the cleanup of anonymous users cleanup and set the password for the root users / run MySQL secure installation.
Go through Link for more information.
Use the following command to check the status,start and stop the MySQL instance.
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf report 3326
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf start 3326
mysqld_multi --defaults-file=/data/mysql/configfiles/mysql_3326.cnf stop 3326
Please feel free to comment/reachme if you have any quesions regarding this installation.
MySQL Internals, MySQL HighAvailability, MySQL Performance Tuning, MySQL Query Optimization, MySQL performance, MySQL Fabric, MySQL HA, MySQL Installation, MySQL Upgrade, InnoDB Performance Tuning, InnoDB Buffer Pool Size, MySQL Performance Tuning, MySQL ClusterMySQL Latest News, News and Events, MySQL Customers