[MySQL]: How to start multiple instances on a single server

 

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] ll -lhtr MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar
-rw-r–r– 1 sm70768 mongod 213M Jun 22 08:25 MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar
MySQL-shared-5.6.25-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.25-1.el6.x86_64.rpm
MySQL-embedded-5.6.25-1.el6.x86_64.rpm
MySQL-devel-5.6.25-1.el6.x86_64.rpm
MySQL-client-5.6.25-1.el6.x86_64.rpm
MySQL-test-5.6.25-1.el6.x86_64.rpm
MySQL-server-5.6.25-1.el6.x86_64.rpm
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] ll -lhtr MySQL-*
-rw-r–r– 1 7155 wheel 18M May 6 13:27 MySQL-client-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 7155 wheel 3.3M May 6 13:27 MySQL-devel-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 7155 wheel 85M May 6 13:27 MySQL-embedded-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 7155 wheel 54M May 6 13:28 MySQL-server-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 7155 wheel 1.9M May 6 13:29 MySQL-shared-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 7155 wheel 3.0M May 6 13:29 MySQL-shared-compat-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 7155 wheel 49M May 6 13:30 MySQL-test-5.6.25-1.el6.x86_64.rpm
-rw-r–r– 1 sm70768 mongod 213M Jun 22 08:25 MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:MySQL-server ########################################### [100%]
2015-06-23 02:29:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-23 02:29:42 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 22469 …
2015-06-23 02:29:42 22469 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-06-23 02:29:42 22469 [Note] InnoDB: The InnoDB memory heap is disabled
2015-06-23 02:29:42 22469 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-06-23 02:29:42 22469 [Note] InnoDB: Memory barrier is not used
2015-06-23 02:29:42 22469 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-06-23 02:29:42 22469 [Note] InnoDB: Using Linux native AIO
2015-06-23 02:29:42 22469 [Note] InnoDB: Using CPU crc32 instructions
2015-06-23 02:29:42 22469 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-06-23 02:29:42 22469 [Note] InnoDB: Completed initialization of buffer pool
2015-06-23 02:29:42 22469 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-06-23 02:29:42 22469 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-06-23 02:29:42 22469 [Note] InnoDB: Database physically writes the file full: wait…
2015-06-23 02:29:42 22469 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-06-23 02:29:43 22469 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-06-23 02:29:43 22469 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-06-23 02:29:43 22469 [Warning] InnoDB: New log files created, LSN=45781
2015-06-23 02:29:43 22469 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-06-23 02:29:43 22469 [Note] InnoDB: Doublewrite buffer created
2015-06-23 02:29:43 22469 [Note] InnoDB: 128 rollback segment(s) are active.
2015-06-23 02:29:43 22469 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-06-23 02:29:43 22469 [Note] InnoDB: Foreign key constraint system tables created
2015-06-23 02:29:43 22469 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-06-23 02:29:43 22469 [Note] InnoDB: Tablespace and datafile system tables created.
2015-06-23 02:29:43 22469 [Note] InnoDB: Waiting for purge to start
2015-06-23 02:29:43 22469 [Note] InnoDB: 5.6.25 started; log sequence number 0
A random root password has been set. You will find it in ‘/root/.mysql_secret’.
2015-06-23 02:29:44 22469 [Note] Binlog end
2015-06-23 02:29:44 22469 [Note] InnoDB: FTS optimize thread exiting.
2015-06-23 02:29:44 22469 [Note] InnoDB: Starting shutdown…
2015-06-23 02:29:45 22469 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2015-06-23 02:29:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-23 02:29:45 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 22512 …
2015-06-23 02:29:45 22512 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-06-23 02:29:45 22512 [Note] InnoDB: The InnoDB memory heap is disabled
2015-06-23 02:29:45 22512 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-06-23 02:29:45 22512 [Note] InnoDB: Memory barrier is not used
2015-06-23 02:29:45 22512 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-06-23 02:29:45 22512 [Note] InnoDB: Using Linux native AIO
2015-06-23 02:29:45 22512 [Note] InnoDB: Using CPU crc32 instructions
2015-06-23 02:29:45 22512 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-06-23 02:29:45 22512 [Note] InnoDB: Completed initialization of buffer pool
2015-06-23 02:29:45 22512 [Note] InnoDB: Highest supported file format is Barracuda.
2015-06-23 02:29:45 22512 [Note] InnoDB: 128 rollback segment(s) are active.
2015-06-23 02:29:45 22512 [Note] InnoDB: Waiting for purge to start
2015-06-23 02:29:45 22512 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2015-06-23 02:29:45 22512 [Note] Binlog end
2015-06-23 02:29:45 22512 [Note] InnoDB: FTS optimize thread exiting.
2015-06-23 02:29:45 22512 [Note] InnoDB: Starting shutdown…
2015-06-23 02:29:47 22512 [Note] InnoDB: Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in ‘/root/.mysql_secret’.

You must change that password on your first connect,
no other statement but ‘SET PASSWORD’ will be accepted.
See the manual for the semantics of the ‘password expired’ flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] rpm -ivh MySQL-client-5.6.25-1.el6.x86_64.rpm
Preparing… ########################################### [100%]
file /usr/bin/msql2mysql from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysql from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysql_find_rows from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysql_waitpid from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlaccess from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlaccess.conf from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqladmin from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlbinlog from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlcheck from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqldump from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlimport from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlshow from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/bin/mysqlslap from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/msql2mysql.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysql.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysql_find_rows.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysql_waitpid.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqlaccess.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqladmin.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqlbinlog.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqlcheck.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqldump.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqlimport.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqlshow.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
file /usr/share/man/man1/mysqlslap.1.gz from install of MySQL-client-5.6.25-1.el6.x86_64 conflicts with file from package MySQL-client-5.5.21-1.linux2.6.x86_64
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] rpm -qa | grep MySQL-client-5.5.21-1.linux2.6.x86_64
MySQL-client-5.5.21-1.linux2.6.x86_64
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] rpm -e MySQL-client-5.5.21-1.linux2.6.x86_64
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] rpm -qa | grep MySQL-client-5.5.21-1.linux2.6.x86_64
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] rpm -ivh MySQL-client-5.6.25-1.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:MySQL-client ########################################### [100%]
[ root @ dbversity : /tmp ]

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] cat /root/.mysql_secret
# The random password set for the root user at Tue Jun 23 02:29:44 2015 (local time): QR3YoXAcvwijySGa

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] ll -lhtr /var/lib/mysql/
total 109M
drwxr-xr-x 2 mysql mysql 4.0K Jun 23 02:29 test
-rw-rw—- 1 mysql mysql 48M Jun 23 02:29 ib_logfile1
drwx—— 2 mysql mysql 4.0K Jun 23 02:29 performance_schema
drwx–x–x 2 mysql mysql 4.0K Jun 23 02:29 mysql
-rw-rw—- 1 mysql mysql 48M Jun 23 02:29 ib_logfile0
-rw-rw—- 1 mysql mysql 12M Jun 23 02:29 ibdata1
-rw-r–r– 1 mysql mysql 111 Jun 23 02:29 RPM_UPGRADE_MARKER-LAST
-rw-r–r– 1 root root 111 Jun 23 02:29 RPM_UPGRADE_HISTORY
[ root @ dbversity : /tmp ]mysql
[ root @ dbversity : /tmp ] /etc/init.d/mysql status
ERROR! MySQL is not running
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] /etc/init.d/mysql start
Starting MySQL.. SUCCESS!
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer ‘n’.

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
… skipping.

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
… skipping.

By default, MySQL comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
… skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
… Success!
All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
Cleaning up…
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] mysql -u root -p”dbvers1tyData” -P 3306
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>
mysql>
mysql>
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
4 rows in set (0.00 sec)
mysql>
mysql>

[ root @ dbversity : /tmp ] mkdir /var/lib/mysql2
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] cp /var/lib/mysql/* /var/lib/mysql2/ -R
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] chown mysql:mysql /var/lib/mysql2/ -R
[ root @ dbversity : /tmp ]

[ root @ dbversity : /tmp ] ps -ef | grep mysql
root 23651 1 0 02:36 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –pid-file=/var/lib/mysql/dbversity.pid
mysql 23754 23651 0 02:36 pts/3 00:00:01 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql/dbversity.err –pid-file=/var/lib/mysql/dbversity.pid
root 25414 21092 0 02:47 pts/3 00:00:00 grep mysql
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] vi /etc/my.cnf2
[client]
port = 3307
socket = /var/lib/mysql2/mysql.sock
[mysqld]
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 600
port = 3307
socket = /var/lib/mysql2/mysql.sock
datadir = /var/lib/mysql2
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M

# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 2G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M

# log-bin=mysql-bin Commented out to save disk space in log file dir
# For MySQL version 5.1.8 or later
# binlog_format=mixed
server-id = 2
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
log-error=/var/lib/mysql2/mysqld.log
pid-file=/var/lib/mysql2/mysqld.pid

skip-show-database=1
log-warnings=2
general-log=1
general-log-file==/var/lib/mysql2/general_query.log
secure-auth=on
local-infile=0

“/etc/my.cnf2” 59L, 1332C written
[ root @ dbversity : /tmp ]

[ root @ dbversity : /tmp ] /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf2 &
[1] 26768
[ root @ dbversity : /tmp ] 150623 02:52:44 mysqld_safe Logging to ‘/var/lib/mysql2/mysqld.log’.
150623 02:52:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql2

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] ps -ef | grep mysql
root 23651 1 0 02:36 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –pid-file=/var/lib/mysql/dbversity.pid
mysql 23754 23651 0 02:36 pts/3 00:00:01 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql/dbversity.err –pid-file=/var/lib/mysql/dbversity.pid
root 26768 21092 0 02:52 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf2
mysql 27221 26768 49 02:52 pts/3 00:00:03 /usr/sbin/mysqld –defaults-file=/etc/my.cnf2 –basedir=/usr –datadir=/var/lib/mysql2 –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql2/mysqld.log –pid-file=/var/lib/mysql2/mysqld.pid –socket=/var/lib/mysql2/mysql.sock –port=3307
root 27270 21092 0 02:52 pts/3 00:00:00 grep mysql
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] kill -9 23754 23651
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] ps -ef | grep mysql
root 26768 21092 0 02:52 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf2
mysql 27221 26768 0 02:52 pts/3 00:00:03 /usr/sbin/mysqld –defaults-file=/etc/my.cnf2 –basedir=/usr –datadir=/var/lib/mysql2 –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql2/mysqld.log –pid-file=/var/lib/mysql2/mysqld.pid –socket=/var/lib/mysql2/mysql.sock –port=3307
root 28931 21092 0 03:02 pts/3 00:00:00 grep mysql
[ root @ dbversity : /tmp ]

[ root @ dbversity : /tmp ] cat /etc/my.cnf1
[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 600
port = 3306
socket = /var/lib/mysql/mysql.sock

read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M

# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 2G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M

# log-bin=mysql-bin Commented out to save disk space in log file dir
# For MySQL version 5.1.8 or later
# binlog_format=mixed
server-id = 2
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
log-error=/var/lib/mysql/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid

skip-show-database=1
log-warnings=2
general-log=1
general-log-file==/var/lib/mysql/general_query.log
secure-auth=on
local-infile=0

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] /bin/sh /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf1 &
[2] 28968
[ root @ dbversity : /tmp ] 150623 03:02:40 mysqld_safe Logging to ‘/var/lib/mysql/mysqld.log’.
150623 03:02:40 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] ps -ef | grep mysql
root 26768 21092 0 02:52 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf2
mysql 27221 26768 0 02:52 pts/3 00:00:03 /usr/sbin/mysqld –defaults-file=/etc/my.cnf2 –basedir=/usr –datadir=/var/lib/mysql2 –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql2/mysqld.log –pid-file=/var/lib/mysql2/mysqld.pid –socket=/var/lib/mysql2/mysql.sock –port=3307
root 28968 21092 0 03:02 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe –defaults-file=/etc/my.cnf1
mysql 29411 28968 3 03:02 pts/3 00:00:04 /usr/sbin/mysqld –defaults-file=/etc/my.cnf1 –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql/mysqld.log –pid-file=/var/lib/mysql/mysqld.pid –socket=/var/lib/mysql/mysql.sock –port=3306
root 29745 21092 0 03:04 pts/3 00:00:00 grep mysql
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ]
[ root @ dbversity : /tmp ] mysql -u root -p”dbversityData” -P 3307 –socket=/var/lib/mysql2/mysql.sock
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. 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 databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
4 rows in set (0.00 sec)

mysql> create database db_in_3307_port;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| db_in_3307_port |
| mysql |
| performance_schema |
| test |
+——————–+
5 rows in set (0.00 sec)

mysql> ^DBye
[ root @ dbversity : /tmp ] mysql -u root -p”dbversityData” -P 3306 –socket=/var/lib/mysql/mysql.sock
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. 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 databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
5 rows in set (0.00 sec)

mysql>

  • Ask Question