Deploy multiple MySQL instances on a [DELL R720] Server

Source: Internet
Author: User

Deploy multiple MySQL instances on a [DELL R720] Server

Deploy multiple MySQL instances on a [DELL R720] Server

I. Prepare for installing mysql

1.1 download the mysql package

Mkdir-p/home/xuekun/mysql

Cd/home/xuekun/tools/mysql

Wgethttp: // dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.10.tar.gz

1.2 install mysql software

Yum-y install make gcc-c ++ cmake bison-devel ncurses-devel

Tarxvf mysql-5.6.16.tar.gz

Cdmysql-5.6.16

Cmake \

-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \

-DMYSQL_DATADIR =/data \

-DSYSCONFDIR =/etc \

-DWITH_MYISAM_STORAGE_ENGINE = 1 \

-DWITH_INNOBASE_STORAGE_ENGINE = 1 \

-DWITH_MEMORY_STORAGE_ENGINE = 1 \

-DWITH_READLINE = 1 \

-DMYSQL_UNIX_ADDR =/var/lib/mysql. sock \

-DMYSQL_TCP_PORT = 3306 \

-DENABLED_LOCAL_INFILE = 1 \

-DWITH_PARTITION_STORAGE_ENGINE = 1 \

-DEXTRA_CHARSETS = all \

-DDEFAULT_CHARSET = utf8 \

-DDEFAULT_COLLATION = utf8_general_ci

 

Make & make install

 

1.3 create a mysql user

Groupadd mysql

Useradd-g mysql-M-s/sbin/nologin mysql

1.4 create a mysql data file directory

Mkdir-p/data/3306/data

Mkdir-p/data/3307/data

Tree/data/

/Data/

| -- 3306.

| '-- Data

'-- 3307

'-- Data

4 directories, 0 files

1.5 authorize mysql users and groups to access the data file directory

Chown-Rmysql: mysql/data/3306

Chown-Rmysql: mysql/data/3307

1.6 create the 3306,330 7my. cnf configuration file

Vim/data/3306/my. cnf

Vim/data/3307/my. cnf

For the content of my. cnf to be added, see Appendix B: or the my. cnf file in the directory of this document.

# Authorize mysql users and groups to access my. cnf

Chown-Rmysql: mysql/data/3306/my. cnf

Chown-Rmysql: mysql/data/3307/my. cnf

1.7 create a mysql Startup Script

Vim/data/3306/mysql

Vim/data/3307/mysql

 

For details about the mysql to be added, see Appendix C: or the mysql file in the directory of this document.

Chmod 700/data/3306/mysql

Chmod 700/data/3307/mysql

1.8 initialize the database

Vim/etc/profile

PATH =/usr/local/mysql/bin: $ PATH

ExportPATH

# Close the file and run the following command to make the configuration take effect immediately

Source/etc/profile

Cd/usr/local/mysql

Scripts/mysql_install_db -- datadir =/data/3306/data

InstallingMySQL system tables...

OK

Filling helptables...

OK

To start mysqldat boot time you have to copy

Support-files/mysql. serverto the right place for your system

Please rememberto set a password for the MySQL root USER!

To do so, startthe server, then issue the following commands:

/Usr/local/mysql/bin/mysqladmin-u root password 'new-password'

/Usr/local/mysql/bin/mysqladmin-u root-h A password 'new-password'

Alternativelyyou can run:

/Usr/local/mysql/bin/mysql_secure_installation

Which will alsogive you the option of removing the test

Databases andanonymous user created by default. This is

Stronglyrecommended for production servers.

See the manualfor more instructions.

You can startthe MySQL daemon:

Cd/usr/local/mysql;/usr/local/mysql/bin/mysqld_safe &

You can testthe MySQL daemon with mysql-test-run.pl

Cd/usr/local/mysql-test; perl mysql-test-run.pl

Please reportany problems with the/usr/local/mysql/bin/mysqlbug script!

 

Scripts/mysql_install_db -- datadir =/data/3307/data

InstallingMySQL system tables...

OK

Filling helptables...

OK

The content above 3306 is omitted here.

 

Chown-Rmysql: mysql/data

1.9 start the database

The command to start a mysql instance is

/Data/3306/mysqlstart

StartingMySQL...

/Data/3307/mysqlstart

StartingMySQL...

Check the startup status:

Netstat-lnt | grep 330 [6-7]

Tcp 0 00.0.0.0: 3306 0.0.0.0: * LISTEN

Tcp 0 00.0.0.0: 3307 0.0.0.0: * LISTEN

Add/etc/rc. local and set it to boot automatically

Echo "/data/3306/mysql start">/etc/rc. local

Echo "/data/3307/mysql start">/etc/rc. local

Cat/etc/rc. local

#! /Bin/sh

#

# This scriptwill be executed * after * all the other init scripts.

# You can putyour own initialization stuff in here if you don't

# Want to dothe full Sys V style init stuff.

Touch/var/lock/subsys/local

/Data/3306/mysqlstart

/Data/3307/mysql start

Tip: if the database in this step cannot be started, please wait a moment. If not, check the error log. The path is at the bottom of my. cnf.

 

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.