SlideShare uma empresa Scribd logo
1 de 26
Install first instance (3306) by using rpm’s
Default installation directory will be/var/lib/mysql
And configuration file location will be/etc/my.cnf
Start the MySql server , it will initialize the database automatically
Service mysql start
Here First instance is already running .i.e 3306
[root@INVIRH54DB3 ~]# service mysql status
MySQL running (14835) [ OK ]
[root@INVIRH54DB3 ~]# mysql -u root -p
Enter password: (mysql)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 6
Server version: 5.5.30-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a
registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be
trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the
current input statement.
mysql> SHOW GLOBAL VARIABLES LIKE '%port%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| innodb_support_xa | ON |
| large_files_support | ON |
| port | 3306 |
| report_host | |
| report_password | |
| report_port | 3306 |
| report_user | |
+---------------------+-------+
7 rows in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sample1 |
| sample2 |
| sample3 |
| sample4 |
| test |
+--------------------+
8 rows in set (0.01 sec)
To run multiple instances using MySQL we need to have a couple of things separate from
the initial install on MySQL like data directory, init script and config file. It is quite that
simple and here is how we do it, I will subscript 2 for all the files/directories that I am
going to create to indicate this new second instance:
Step 1. Create a new data directory [/var/lib/Instances/INFA1] and
[/var/lib/Instances/INFA2] make mysql user own it.(3307,3308)
[root@INVIRH54DB3 ~]# mkdir /var/lib/Instances
[root@INVIRH54DB3 ~]# chown -R mysql:mysql /var/lib/Instances/
[root@INVIRH54DB3 ~]# mkdir /var/lib/Instances/INFA1
[root@INVIRH54DB3 ~]# mkdir /var/lib/Instances/INFA2
[root@INVIRH54DB3 ~]# chown -R mysql:mysql /var/lib/Instances/INFA1
[root@INVIRH54DB3 ~]# chown -R mysql:mysql /var/lib/Instances/INFA2
Step : 2. Create a new mysql configuration file
Next we need a separate configuration file. We can start by copying the existing one and
changing the needed values. We just copy this folder and modify it from there.
If you use a redhat variant package then your configuration file is under /etc/my.cnf by
default and you can just copy it directly:(or change the path appropriately for your
configuration file is in a different place).
Next, we need to edit our new configuration file and at least update the mysql
port (default to 3306), the pid and socket to be different than the default ones, and also
point the data and logfolders to the ones created before.
[root@INVIRH54DB3 ~]# cp /etc/my.cnf /etc/my3307.cnf
[root@INVIRH54DB3 ~]# cp /etc/my.cnf /etc/my3308.cnf
New Instances Directories should be like this:
[root@INVIRH54DB3 lib]# cd Instances/
[root@INVIRH54DB3 Instances]# ls –ltr
drwxr-xr-x 2 mysql mysql 4096 May 31 09:50 INFA1
drwxr-xr-x 2 mysql mysql 4096 May 31 09:50 INFA2
Step: 3Edit cnf file for port number 3307 (Sample 3307.cnf File)
[client]
password = your_password
port = 3307
socket = /var/lib/Instances/INFA1/mysql3307.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3307
datadir=/var/lib/Instnaces/INFA1
socket = /var/lib/Instances/INFA1/mysql3307.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character_set_server = utf8
collation_server = utf8_general_ci
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/lib/Instances/INFA1
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/Instances/INFA1
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
Step: 4 Edit cnf file for port number 3308 (Sample 3308.cnf File)
[client]
password = your_password
port = 3308
socket = /tmp/mysql3308.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3308
datadir=/var/lib/Instances/INFA2
socket = /tmp/mysql3308.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character_set_server = utf8
collation_server = utf8_general_ci
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/lib/Instances/INFA2
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/Instances/INFA2
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
Step 5. Install default tables for this new database instance (3307)
[root@INVIRH54DB3 ~]# /usr/bin/mysql_install_db --basedir=/usr/ --
datadir=/var/lib/Instances/INFA1/
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copysupport-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:
/usr//bin/mysqladmin -u root password 'new-password'
/usr//bin/mysqladmin -u root -h INVIRH54DB3 password 'new-password'
Alternatively you can run:
/usr//bin/mysql_secure_installation
which will also give you the option of removing the testdatabases and anonymous user
created by default. This isstrongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/ ; /usr//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr//scripts/mysqlbug script!
Step 6 : Install default tables for this new database instance (3308)
[root@INVIRH54DB3 ~]# /usr/bin/mysql_install_db --basedir=/usr/ --
datadir=/var/lib/Instances/INFA2/
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copysupport-files/mysql.server to the right place
for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To
do so, start the server, then issue the following commands:
/usr//bin/mysqladmin -u root password 'new-password'
/usr//bin/mysqladmin -u root -h INVIRH54DB3 password 'new-password'
Alternatively you can run:
/usr//bin/mysql_secure_installation
which will also give you the option of removing the testdatabases and anonymous user
created by default. This isstrongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/ ; /usr//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr//scripts/mysqlbug script!
Directory Checking :
[root@INVIRH54DB3 Instances]# chown -R mysql:mysql INFA1
[root@INVIRH54DB3 Instances]# chown -R mysql:mysql INFA2
[root@INVIRH54DB3 Instances]# cd INFA1
[root@INVIRH54DB3 INFA1]# ls -ltr
drwx------ 2 mysql mysql 4096 May 31 10:10 test
drwx------ 2 mysql mysql 4096 May 31 10:10 performance_schema
-rw-rw---- 1 mysql mysql 38 May 31 10:10 mysql-bin.index
-rw-rw---- 1 mysql mysql 27308 May 31 10:10 mysql-bin.000001
drwx------ 2 mysql mysql 4096 May 31 10:10 mysql
-rw-rw---- 1 mysql mysql 1036239 May 31 10:10 mysql-bin.000002
[root@INVIRH54DB3 Instances]# cd INFA2
[root@INVIRH54DB3 INFA2]# ls -ltr
drwx------ 2 mysql mysql 4096 May 31 10:13 test
drwx------ 2 mysql mysql 4096 May 31 10:13 performance_schema
-rw-rw---- 1 mysql mysql 27308 May 31 10:13 mysql-bin.000001
drwx------ 2 mysql mysql 4096 May 31 10:13 mysql
-rw-rw---- 1 mysql mysql 38 May 31 10:13 mysql-bin.index
-rw-rw---- 1 mysql mysql 1036239 May 31 10:13 mysql-bin.000002
Step :7 Finally we can start our new mysql instance with: (3307.cnf)
[root@INVIRH54DB3 ~]# /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --
basedir=/usr --datadir=/var/lib/Instances/INFA1 &
130531 10:21:58 mysqld_safe Logging to '/var/lib/Instances/INFA1/INVIRH54DB3.err'.
130531 10:21:59 mysqld_safe Starting mysqld daemon with databases from
/var/lib/Instances/INFA1
130531 10:22:17 mysqld_safe mysqld from pid file
/var/lib/Instances/INFA1/INVIRH54DB3.pid ended
Step :8Finally we can start our new mysql instance with: (3308.cnf)
[root@INVIRH54DB3 ~]# /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf --
basedir=/usr --datadir=/var/lib/Instances/INFA2 &
[root@INVIRH54DB3 ~]# 130531 10:24:25 mysqld_safe Logging to
'/var/lib/Instances/INFA2/INVIRH54DB3.err'.
130531 10:24:26 mysqld_safe Starting mysqld daemon with databases from
/var/lib/Instances/INFA2
Step :9 Checking the Mysql new instances are running or not (3307 & 3308)
[root@INVIRH54DB3 ~]# ps -ef | grep -i mysql
root 14422 1 0 May30 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --
datadir=/var/lib/mysql --pid-file=/var/lib/mysql/INVIRH54DB3.pid
mysql 14835 14422 0 May30 ? 00:00:05 /usr/sbin/mysqld --basedir=/usr --
datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-
error=/var/lib/mysql/INVIRH54DB3.err --pid-file=/var/lib/mysql/INVIRH54DB3.pid --
socket=/var/lib/mysql/mysql.sock --port=3306
root 23827 27077 0 May30 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-
file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/INFA1/data
mysql 24201 23827 0 May30 pts/0 00:00:05 /usr/sbin/mysqld --defaults-
file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/INFA1/data --plugin-
dir=/usr/lib64/mysql/plugin --user=mysql --log-
error=/var/lib/INFA1/data/INVIRH54DB3.err --pid-
file=/var/lib/INFA1/data/INVIRH54DB3.pid --socket=/tmp/mysql3307.sock --port=3307
root 30211 27077 0 10:24 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-
file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2
mysql 30621 30211 0 10:24 pts/0 00:00:02 /usr/sbin/mysqld --defaults-
file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2 --plugin-
dir=/usr/lib64/mysql/plugin --user=mysql --log-
error=/var/lib/Instances/INFA2/INVIRH54DB3.err --pid-
file=/var/lib/Instances/INFA2/INVIRH54DB3.pid --socket=/tmp/mysql3308.sock --
port=3308
Step: 10We can connect to our new instance using 3307
Make sure thehere password is empty, just press enter button ,it will connect mysql
prompt.
[root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3307.sock
Enter password: (Press Enter)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2013,
Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle
Corporation and/or itsaffiliates. Other names may be trademarks of their
respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input
statement.
mysql> SHOW GLOBAL VARIABLES LIKE '%port%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| innodb_support_xa | ON |
| large_files_support | ON |
| port | 3307 |
| report_host | |
| report_password | |
| report_port | 3307 |
| report_user | |
+---------------------+-------+
7 rows in set (0.00 sec)
And also check innodb files…
Step :11We can connect to our new instance using 3308
Make sure the password is empty ,just press enter button ,it will connect mysql promt.
Later we update the password after connecting mysql prompt.
[root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3308.sock
Enter password: (empty)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2013,
Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle
Corporation and/or itsaffiliates. Other names may be trademarks of their respective
owners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> SHOW GLOBAL VARIABLES LIKE '%port%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| innodb_support_xa | ON |
| large_files_support | ON |
| port | 3308 |
| report_host | |
| report_password | |
| report_port | 3308 |
| report_user | |
+---------------------+-------+
7 rows in set (0.00 sec)
And also check innodb files…
Step 12:To check Directories on each new instance.It should be like this.
For INFA1 –3307
Step 13: To check Directories on each new instance.It should be like this.
For INFA2 --- 3308
Step 14: To check /tmp Directory .It should be like this.
If you want to create log file on cnf file ,we can mention like this .
log-bin=/var/lib/INFA1/3307.log
Step 15 : If we no longer need it, stop it with the following command. (Shutdown
particular port instance 3307)
/usr/bin/mysqladmin -u root -S /tmp/mysql3307.sock shutdown -p
Enter password: (Here password is mysql)
130531 14:15:59 mysqld_safe mysqld from pid file
/var/lib/Instances/INFA1/INVIRH54DB3.pid ended[5] Done
/usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --basedir=/usr --
datadir=/var/lib/Instances/INFA1
Here password is empty. Untill we set password on particular host
Step 16: Process checking after shutdown the port (3307)
After shut downing the particular port ,if you want to start again means, we can run this
command.
/usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --basedir=/usr --
datadir=/var/lib/Instances/INFA1 &
Once the service is starts we can check process (3307),
[root@INVIRH54DB3 ~]# ps -ef | grep -i mysql
root 8286 1 0 13:48 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --
datadir=/var/lib/mysql --pid-file=/var/lib/mysql/INVIRH54DB3.pid
mysql 8699 8286 0 13:48 pts/0 00:00:00 /usr/sbin/mysqld --basedir=/usr --
datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-
error=/var/lib/mysql/INVIRH54DB3.err --pid-file=/var/lib/mysql/INVIRH54DB3.pid --
socket=/var/lib/mysql/mysql.sock --port=3306
root 10783 27077 0 14:21 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-
file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA1
mysql 11191 10783 0 14:21 pts/0 00:00:00 /usr/sbin/mysqld --defaults-
file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA1 --plugin-
dir=/usr/lib64/mysql/plugin --user=mysql --log-
error=/var/lib/Instances/INFA1/INVIRH54DB3.err --pid-
file=/var/lib/Instances/INFA1/INVIRH54DB3.pid --
socket=/var/lib/Instances/INFA1/mysql3307.sock --port=3307
root 11281 27077 0 14:23 pts/0 00:00:00 grep -i mysql
root 30211 27077 0 10:24 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-
file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2
mysql 30621 30211 0 10:24 pts/0 00:00:03 /usr/sbin/mysqld --defaults-
file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2 --plugin-
dir=/usr/lib64/mysql/plugin --user=mysql --log-
error=/var/lib/Instances/INFA2/INVIRH54DB3.err --pid-
file=/var/lib/Instances/INFA2/INVIRH54DB3.pid --socket=/tmp/mysql3308.sock --
port=3308
Step 17 : Check for the instances running on the machine.
[root@INVIRH54DB3 ~]# lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
mysqld 8699 mysql 11u IPv4 385132 TCP *:mysql (LISTEN)
[root@INVIRH54DB3 ~]# lsof -i :3307
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
mysqld 11191 mysql 11u IPv4 387891 TCP *:opsession-prxy (LISTEN)
[root@INVIRH54DB3 ~]# lsof -i :3308
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
mysqld 30621 mysql 11u IPv4 373622 TCP *:tns-server (LISTEN)
Step 18 :UPDATE THE PASSSWORD after login mysql prompt (3307)
[root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3307.sock
Enter password: (Here password is empty)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4Server version: 5.5.30-log MySQL Community Server
(GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a
registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be
trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the
current input statement.
mysql> use mysql;
mysql> UPDATE user SET PASSWORD=PASSWORD('mysql') WHERE USER='root';
mysql> FLUSH PRIVILEGES;
Step 19 :UPDATE THE PASSSWORD after login mysql prompt (3308)
[root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3308.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3Server version: 5.5.30-log MySQL Community Server
(GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names
may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to
clear the current input statement.
mysql> use mysql;
mysql> UPDATE user SET PASSWORD=PASSWORD('mysql') WHERE USER='root';
mysql> FLUSH PRIVILEGES;
Useful Links :
http://linuxhackadmin.blogspot.in/2013/02/mysql-multiple-instance-installation.html
http://opensourcedbms.com/dbms/running-multiple-mysql-5-6-instances-on-one-server-
in-centos-6rhel-6fedora/
http://www.ducea.com/2009/01/19/running-multiple-instances-of-mysql-on-the-same-
machine/

Mais conteúdo relacionado

Mais procurados

MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
elliando dias
 

Mais procurados (20)

Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7
 
Recent my sql_performance Test detail
Recent my sql_performance Test detailRecent my sql_performance Test detail
Recent my sql_performance Test detail
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdb
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
MySQL async message subscription platform
MySQL async message subscription platformMySQL async message subscription platform
MySQL async message subscription platform
 
Database decommission process
Database decommission processDatabase decommission process
Database decommission process
 
Lab 1 my sql tutorial
Lab 1 my sql tutorial Lab 1 my sql tutorial
Lab 1 my sql tutorial
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document Store
 
HandlerSocket - A NoSQL plugin for MySQL
HandlerSocket - A NoSQL plugin for MySQLHandlerSocket - A NoSQL plugin for MySQL
HandlerSocket - A NoSQL plugin for MySQL
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016
 
MongoDB Database Replication
MongoDB Database ReplicationMongoDB Database Replication
MongoDB Database Replication
 
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp KrennJavantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard Setup
 
Spider Setup with AWS/sandbox
Spider Setup with AWS/sandboxSpider Setup with AWS/sandbox
Spider Setup with AWS/sandbox
 
Replica Sets (NYC NoSQL Meetup)
Replica Sets (NYC NoSQL Meetup)Replica Sets (NYC NoSQL Meetup)
Replica Sets (NYC NoSQL Meetup)
 
Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2Install and upgrade Oracle grid infrastructure 12.1.0.2
Install and upgrade Oracle grid infrastructure 12.1.0.2
 

Destaque (10)

Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retore
 
Multiple instances second method
Multiple instances second methodMultiple instances second method
Multiple instances second method
 
Database migration
Database migrationDatabase migration
Database migration
 
MySQL Crash Course, Chapter 1
MySQL Crash Course, Chapter 1MySQL Crash Course, Chapter 1
MySQL Crash Course, Chapter 1
 
Performence tuning
Performence tuningPerformence tuning
Performence tuning
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysql
 
Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10
 
Ddl commands
Ddl commandsDdl commands
Ddl commands
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
Lenguaje de programación MySQL
Lenguaje de programación MySQLLenguaje de programación MySQL
Lenguaje de programación MySQL
 

Semelhante a Multiple instances on linux

Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
webhostingguy
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
webhostingguy
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
Yiwei Ma
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
maclean liu
 

Semelhante a Multiple instances on linux (20)

Mysql
Mysql Mysql
Mysql
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0Oracle 11g R2 RAC setup on rhel 5.0
Oracle 11g R2 RAC setup on rhel 5.0
 
My SQL 101
My SQL 101My SQL 101
My SQL 101
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Operation outbreak
Operation outbreakOperation outbreak
Operation outbreak
 
Sql installation
Sql installationSql installation
Sql installation
 
Mysql-Basics.pptx
Mysql-Basics.pptxMysql-Basics.pptx
Mysql-Basics.pptx
 
Linux configer
Linux configerLinux configer
Linux configer
 
MariaDB10.7_install_Ubuntu.docx
MariaDB10.7_install_Ubuntu.docxMariaDB10.7_install_Ubuntu.docx
MariaDB10.7_install_Ubuntu.docx
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Multiple instances on linux

  • 1. Install first instance (3306) by using rpm’s Default installation directory will be/var/lib/mysql And configuration file location will be/etc/my.cnf Start the MySql server , it will initialize the database automatically Service mysql start Here First instance is already running .i.e 3306 [root@INVIRH54DB3 ~]# service mysql status MySQL running (14835) [ OK ] [root@INVIRH54DB3 ~]# mysql -u root -p Enter password: (mysql) Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 6 Server version: 5.5.30-log MySQL Community Server (GPL) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> SHOW GLOBAL VARIABLES LIKE '%port%'; +---------------------+-------+ | Variable_name | Value | +---------------------+-------+ | innodb_support_xa | ON | | large_files_support | ON | | port | 3306 | | report_host | | | report_password | | | report_port | 3306 | | report_user | | +---------------------+-------+ 7 rows in set (0.00 sec)
  • 2. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sample1 | | sample2 | | sample3 | | sample4 | | test | +--------------------+ 8 rows in set (0.01 sec)
  • 3.
  • 4. To run multiple instances using MySQL we need to have a couple of things separate from the initial install on MySQL like data directory, init script and config file. It is quite that simple and here is how we do it, I will subscript 2 for all the files/directories that I am going to create to indicate this new second instance: Step 1. Create a new data directory [/var/lib/Instances/INFA1] and [/var/lib/Instances/INFA2] make mysql user own it.(3307,3308) [root@INVIRH54DB3 ~]# mkdir /var/lib/Instances [root@INVIRH54DB3 ~]# chown -R mysql:mysql /var/lib/Instances/ [root@INVIRH54DB3 ~]# mkdir /var/lib/Instances/INFA1 [root@INVIRH54DB3 ~]# mkdir /var/lib/Instances/INFA2 [root@INVIRH54DB3 ~]# chown -R mysql:mysql /var/lib/Instances/INFA1 [root@INVIRH54DB3 ~]# chown -R mysql:mysql /var/lib/Instances/INFA2 Step : 2. Create a new mysql configuration file Next we need a separate configuration file. We can start by copying the existing one and changing the needed values. We just copy this folder and modify it from there. If you use a redhat variant package then your configuration file is under /etc/my.cnf by default and you can just copy it directly:(or change the path appropriately for your configuration file is in a different place). Next, we need to edit our new configuration file and at least update the mysql port (default to 3306), the pid and socket to be different than the default ones, and also point the data and logfolders to the ones created before. [root@INVIRH54DB3 ~]# cp /etc/my.cnf /etc/my3307.cnf [root@INVIRH54DB3 ~]# cp /etc/my.cnf /etc/my3308.cnf
  • 5. New Instances Directories should be like this: [root@INVIRH54DB3 lib]# cd Instances/ [root@INVIRH54DB3 Instances]# ls –ltr drwxr-xr-x 2 mysql mysql 4096 May 31 09:50 INFA1 drwxr-xr-x 2 mysql mysql 4096 May 31 09:50 INFA2 Step: 3Edit cnf file for port number 3307 (Sample 3307.cnf File) [client] password = your_password port = 3307 socket = /var/lib/Instances/INFA1/mysql3307.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3307 datadir=/var/lib/Instnaces/INFA1 socket = /var/lib/Instances/INFA1/mysql3307.sock skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K
  • 6. myisam_sort_buffer_size = 8M character_set_server = utf8 collation_server = utf8_general_ci # Uncomment the following if you are using InnoDB tables innodb_data_home_dir = /var/lib/Instances/INFA1 innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /var/lib/Instances/INFA1 # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size innodb_log_file_size = 5M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50
  • 7. Step: 4 Edit cnf file for port number 3308 (Sample 3308.cnf File) [client] password = your_password port = 3308 socket = /tmp/mysql3308.sock # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3308 datadir=/var/lib/Instances/INFA2 socket = /tmp/mysql3308.sock skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M character_set_server = utf8 collation_server = utf8_general_ci
  • 8. # Uncomment the following if you are using InnoDB tables innodb_data_home_dir = /var/lib/Instances/INFA2 innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /var/lib/Instances/INFA2 # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size innodb_log_file_size = 5M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50
  • 9. Step 5. Install default tables for this new database instance (3307) [root@INVIRH54DB3 ~]# /usr/bin/mysql_install_db --basedir=/usr/ -- datadir=/var/lib/Instances/INFA1/ Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copysupport-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: /usr//bin/mysqladmin -u root password 'new-password' /usr//bin/mysqladmin -u root -h INVIRH54DB3 password 'new-password' Alternatively you can run: /usr//bin/mysql_secure_installation which will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr/ ; /usr//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr//mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr//scripts/mysqlbug script!
  • 10. Step 6 : Install default tables for this new database instance (3308) [root@INVIRH54DB3 ~]# /usr/bin/mysql_install_db --basedir=/usr/ -- datadir=/var/lib/Instances/INFA2/ Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands: /usr//bin/mysqladmin -u root password 'new-password' /usr//bin/mysqladmin -u root -h INVIRH54DB3 password 'new-password' Alternatively you can run: /usr//bin/mysql_secure_installation which will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.
  • 11. See the manual for more instructions. You can start the MySQL daemon with: cd /usr/ ; /usr//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr//mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr//scripts/mysqlbug script! Directory Checking : [root@INVIRH54DB3 Instances]# chown -R mysql:mysql INFA1 [root@INVIRH54DB3 Instances]# chown -R mysql:mysql INFA2 [root@INVIRH54DB3 Instances]# cd INFA1 [root@INVIRH54DB3 INFA1]# ls -ltr drwx------ 2 mysql mysql 4096 May 31 10:10 test drwx------ 2 mysql mysql 4096 May 31 10:10 performance_schema -rw-rw---- 1 mysql mysql 38 May 31 10:10 mysql-bin.index
  • 12. -rw-rw---- 1 mysql mysql 27308 May 31 10:10 mysql-bin.000001 drwx------ 2 mysql mysql 4096 May 31 10:10 mysql -rw-rw---- 1 mysql mysql 1036239 May 31 10:10 mysql-bin.000002 [root@INVIRH54DB3 Instances]# cd INFA2 [root@INVIRH54DB3 INFA2]# ls -ltr drwx------ 2 mysql mysql 4096 May 31 10:13 test drwx------ 2 mysql mysql 4096 May 31 10:13 performance_schema -rw-rw---- 1 mysql mysql 27308 May 31 10:13 mysql-bin.000001 drwx------ 2 mysql mysql 4096 May 31 10:13 mysql -rw-rw---- 1 mysql mysql 38 May 31 10:13 mysql-bin.index -rw-rw---- 1 mysql mysql 1036239 May 31 10:13 mysql-bin.000002 Step :7 Finally we can start our new mysql instance with: (3307.cnf) [root@INVIRH54DB3 ~]# /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf -- basedir=/usr --datadir=/var/lib/Instances/INFA1 &
  • 13. 130531 10:21:58 mysqld_safe Logging to '/var/lib/Instances/INFA1/INVIRH54DB3.err'. 130531 10:21:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/Instances/INFA1 130531 10:22:17 mysqld_safe mysqld from pid file /var/lib/Instances/INFA1/INVIRH54DB3.pid ended Step :8Finally we can start our new mysql instance with: (3308.cnf) [root@INVIRH54DB3 ~]# /usr/bin/mysqld_safe --defaults-file=/etc/my3308.cnf -- basedir=/usr --datadir=/var/lib/Instances/INFA2 & [root@INVIRH54DB3 ~]# 130531 10:24:25 mysqld_safe Logging to '/var/lib/Instances/INFA2/INVIRH54DB3.err'. 130531 10:24:26 mysqld_safe Starting mysqld daemon with databases from /var/lib/Instances/INFA2 Step :9 Checking the Mysql new instances are running or not (3307 & 3308) [root@INVIRH54DB3 ~]# ps -ef | grep -i mysql root 14422 1 0 May30 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe -- datadir=/var/lib/mysql --pid-file=/var/lib/mysql/INVIRH54DB3.pid mysql 14835 14422 0 May30 ? 00:00:05 /usr/sbin/mysqld --basedir=/usr -- datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log- error=/var/lib/mysql/INVIRH54DB3.err --pid-file=/var/lib/mysql/INVIRH54DB3.pid -- socket=/var/lib/mysql/mysql.sock --port=3306
  • 14. root 23827 27077 0 May30 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults- file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/INFA1/data mysql 24201 23827 0 May30 pts/0 00:00:05 /usr/sbin/mysqld --defaults- file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/INFA1/data --plugin- dir=/usr/lib64/mysql/plugin --user=mysql --log- error=/var/lib/INFA1/data/INVIRH54DB3.err --pid- file=/var/lib/INFA1/data/INVIRH54DB3.pid --socket=/tmp/mysql3307.sock --port=3307 root 30211 27077 0 10:24 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults- file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2 mysql 30621 30211 0 10:24 pts/0 00:00:02 /usr/sbin/mysqld --defaults- file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2 --plugin- dir=/usr/lib64/mysql/plugin --user=mysql --log- error=/var/lib/Instances/INFA2/INVIRH54DB3.err --pid- file=/var/lib/Instances/INFA2/INVIRH54DB3.pid --socket=/tmp/mysql3308.sock -- port=3308
  • 15. Step: 10We can connect to our new instance using 3307 Make sure thehere password is empty, just press enter button ,it will connect mysql prompt. [root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3307.sock Enter password: (Press Enter) Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1 Server version: 5.5.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> SHOW GLOBAL VARIABLES LIKE '%port%'; +---------------------+-------+ | Variable_name | Value | +---------------------+-------+ | innodb_support_xa | ON | | large_files_support | ON | | port | 3307 | | report_host | | | report_password | | | report_port | 3307 | | report_user | | +---------------------+-------+ 7 rows in set (0.00 sec)
  • 16. And also check innodb files…
  • 17. Step :11We can connect to our new instance using 3308 Make sure the password is empty ,just press enter button ,it will connect mysql promt. Later we update the password after connecting mysql prompt. [root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3308.sock Enter password: (empty) Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1
  • 18. Server version: 5.5.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respective owners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> SHOW GLOBAL VARIABLES LIKE '%port%'; +---------------------+-------+ | Variable_name | Value | +---------------------+-------+ | innodb_support_xa | ON | | large_files_support | ON | | port | 3308 | | report_host | | | report_password | | | report_port | 3308 | | report_user | | +---------------------+-------+ 7 rows in set (0.00 sec)
  • 19. And also check innodb files…
  • 20. Step 12:To check Directories on each new instance.It should be like this. For INFA1 –3307
  • 21. Step 13: To check Directories on each new instance.It should be like this. For INFA2 --- 3308 Step 14: To check /tmp Directory .It should be like this. If you want to create log file on cnf file ,we can mention like this . log-bin=/var/lib/INFA1/3307.log Step 15 : If we no longer need it, stop it with the following command. (Shutdown particular port instance 3307) /usr/bin/mysqladmin -u root -S /tmp/mysql3307.sock shutdown -p Enter password: (Here password is mysql) 130531 14:15:59 mysqld_safe mysqld from pid file /var/lib/Instances/INFA1/INVIRH54DB3.pid ended[5] Done /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --basedir=/usr -- datadir=/var/lib/Instances/INFA1
  • 22. Here password is empty. Untill we set password on particular host Step 16: Process checking after shutdown the port (3307) After shut downing the particular port ,if you want to start again means, we can run this command. /usr/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --basedir=/usr -- datadir=/var/lib/Instances/INFA1 & Once the service is starts we can check process (3307), [root@INVIRH54DB3 ~]# ps -ef | grep -i mysql root 8286 1 0 13:48 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe -- datadir=/var/lib/mysql --pid-file=/var/lib/mysql/INVIRH54DB3.pid mysql 8699 8286 0 13:48 pts/0 00:00:00 /usr/sbin/mysqld --basedir=/usr -- datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log- error=/var/lib/mysql/INVIRH54DB3.err --pid-file=/var/lib/mysql/INVIRH54DB3.pid -- socket=/var/lib/mysql/mysql.sock --port=3306 root 10783 27077 0 14:21 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults- file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA1 mysql 11191 10783 0 14:21 pts/0 00:00:00 /usr/sbin/mysqld --defaults- file=/etc/my3307.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA1 --plugin- dir=/usr/lib64/mysql/plugin --user=mysql --log- error=/var/lib/Instances/INFA1/INVIRH54DB3.err --pid-
  • 23. file=/var/lib/Instances/INFA1/INVIRH54DB3.pid -- socket=/var/lib/Instances/INFA1/mysql3307.sock --port=3307 root 11281 27077 0 14:23 pts/0 00:00:00 grep -i mysql root 30211 27077 0 10:24 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults- file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2 mysql 30621 30211 0 10:24 pts/0 00:00:03 /usr/sbin/mysqld --defaults- file=/etc/my3308.cnf --basedir=/usr --datadir=/var/lib/Instances/INFA2 --plugin- dir=/usr/lib64/mysql/plugin --user=mysql --log- error=/var/lib/Instances/INFA2/INVIRH54DB3.err --pid- file=/var/lib/Instances/INFA2/INVIRH54DB3.pid --socket=/tmp/mysql3308.sock -- port=3308 Step 17 : Check for the instances running on the machine. [root@INVIRH54DB3 ~]# lsof -i :3306 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME mysqld 8699 mysql 11u IPv4 385132 TCP *:mysql (LISTEN) [root@INVIRH54DB3 ~]# lsof -i :3307 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME mysqld 11191 mysql 11u IPv4 387891 TCP *:opsession-prxy (LISTEN) [root@INVIRH54DB3 ~]# lsof -i :3308 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME mysqld 30621 mysql 11u IPv4 373622 TCP *:tns-server (LISTEN)
  • 24. Step 18 :UPDATE THE PASSSWORD after login mysql prompt (3307) [root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3307.sock Enter password: (Here password is empty) Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 4Server version: 5.5.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> use mysql; mysql> UPDATE user SET PASSWORD=PASSWORD('mysql') WHERE USER='root'; mysql> FLUSH PRIVILEGES;
  • 25. Step 19 :UPDATE THE PASSSWORD after login mysql prompt (3308) [root@INVIRH54DB3 ~]# mysql -u root -p -S /tmp/mysql3308.sock Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3Server version: 5.5.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> use mysql; mysql> UPDATE user SET PASSWORD=PASSWORD('mysql') WHERE USER='root'; mysql> FLUSH PRIVILEGES;