Foreword: The leader asks to install multiple MySQL instance one on 1 dell r710, installs the 1th instance 1, the current system cat /etc/debian_version 6.0.102, the view installs the package Apt-cache search mysql-server|grep "Mysql-server" mysql-server-5.1 - mysql database Server binaries and system database setupmysql-server-core-5.1 - mysql database server binariesmysql-server - MySQL database server ( metapackage depending on the latest version) 3, install MySQL (will install a series of MySQL-related packages) apt-get - Y install mysql-server --force-yes Two, install the second instance 1, create a directory (I will install the second instance under/OPT) cd /opt/mkdir mysql33072, copying MySQL tables and configuration files cd /var/lib/mysql/cp -a mysql /opt/mysql3307/cp /etc/mysql/ MY.CNF /OPT/MYSQL3307/3, modify the configuration (usually change the port and sock and PID and DataDir path) port = 3307socket = /var/run/mysqld/mysqld3307.sockpid-file = /var/run/mysqld/mysqld3307.piddatadir = /opt/mysql33074, give MySQL permission chown -r mysql.root  /OPT/MYSQL3307/5, start MySQL (here with MySQL user) to modify the/etc/passed file Mysql:x:102:104:mysql server,,,:/var/lib/mysql :/BIN/BASHSU - MYSQL/USR/SBIN/MYSQLD --DEFAULTS-FILE=/OPT/MYSQL3307/MY.CNF --BASEDIR=/USR --datadir=/opt/mysql3307/ --user=mysql --pid-file=/var/run/mysqld/mysqld3307.pid -- skip-external-locking --port=3307 --socket=/var/run/mysqld/mysqld3307.sock &[1] 2484150505 9:30:06 [note] plugin ' Federated ' is disabled.150505 9:30:07 innodb: initializing buffer pool, size = 8.0m150505 9:30:07 innodb: completed initialization of buffer poolinnodb: the first specified data file ./ibdata1 did not exist:innodb: a new database to be created!150505 9:30:07 InnoDB: Setting file ./ibdata1 Size to 10 mbinnodb: database physically writes the file full: wait ... 150505 9:30:07 innodb: log file ./ib_logfile0 did not exist: new to be createdinnodb: setting log file ./ib_logfile0 Size to 5 mbinnodb: database physically writes the file full: wait ... 150505 9:30:07 innodb: log file ./ib_logfile1 did not exist: new to be createdinnodb: setting log file ./ib_logfile1 Size to 5 mbinnodb: database physically writes the file full: wAit ... innodb: doublewrite buffer not found: creating newinnodb: doublewrite Buffer createdinnodb: creating foreign key constraint system tablesinnodb: Foreign key constraint system tables created150505 9:30:07 innodb: started; log sequence number 0 0150505 9:30:07 [ Note] event scheduler: loaded 0 events150505 9:30:07 [note] /usr /sbin/mysqld: ready for connections. version: ' 5.1.73-1 ' socket: '/var/run/mysqld/mysqld3307.sock ' port: 3307 (Debian) 6, last view 2 MySQL instances are working properly ps aux|grep mysqlroot 2152 0.0 0.0 3956 616 ? s 08:53 0:00 /bin/sh /usr/bin/mysqld_safemysql 2276 0.0 3.6 182456 37560 ? Sl 08:53 0:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306root 2277 0.0 0.0 5348 688 ? s 08:53 0:00 logger -t mysqld -p daemon.errormysql 2480 0.0 0.1 36884 1232 pts/0 s 09:29 0:00 su - mysqlmysql 2481 0.0 0.1 19220 1976 pts/0 s 09:29 0:00 -sumysql 2484 5.5 3.6 174064 37004 pts/0 Sl 09:30 0:00 /usr/sbin/mysqld --defaults-file=/opt/mysql3307/my.cnf --basedir=/usr --datadir=/opt/mysql3307/ --user=mysql --pid-file=/var/run/mysqld/mysqld3307.pid --skip-external-locking --port=3307 --socket=/ var/run/mysqld/mysqld3307.sockmysql 2495 0.0 0.1 16340 1136 pts/0 r+ 09:30 0:00 ps auxmysql 2496 0.0 0.0 7548 820 pts/0 S+ 09:30 0:00 GREP MYSQL7, login 2 MySQL instances to seemysql -uroot -predhat -s /var/run/mysqld/mysqld.sock welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 54server version: 5.1.73-1 (Debian) 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> quitbyemysql -uroot -predhat -s /var/run/mysqld/ Mysqld3307.sock welcome to the mysql monitor. commands end with ; or \g.your MySQL connection id is 1Server version: 5.1.73-1 (Debian) 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> quitBye[email protected]:~$ engine current version engine Mysql -uroot -predhat -S /var/run/mysqld/mysqld.sock -e "show engines;" +------------+---------+----------------------------------------------------------------+--------------+------+ ------------+| engine | support | comment | Transactions | xa | savepoints |+------------+---------+------------------------------------------ ----------------------+--------------+------+------------+| innodb | Yes | supports transactions, row-level locking, and foreign keys | YES | yes | yes | | MRG_MYISAM | YES | Collection of identical myisam tables | no | no | no | | blackhole | yes | /dev/null storage engine (Anything you write to it disappears) | NO | NO | NO | | csv | yes | csv storage engine | no | no | no | | memory | yes | hash based, stored in memory, useful for temporary tables | NO | NO | no | | FEDERATED | NO | Federated MySQL storage engine | null | null | null | | ARCHIVE | YES | Archive storage engine | NO | no | no | | MyISAM | DEFAULT | Default engine as of mysql 3.23 with great performance | no | no | no |+------------+---------+----------------------------------------------------------------+--------------+------+------------+ Config modify default engine for InnoDB is in [Mysqld] This inside default_table_type = innodb5.5 words the default engine is directly InnoDB No need to modify
This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1650434
Install multiple MySQL instances (Debian version)