Linux build MySQL Master service

Source: Internet
Author: User

On the internet to find more than n information, no one can successfully succeed, depressed, may be the level of limited bar ...! I through continuous research, testing, complete implementation of Linux under the start of two MySQL, and MySQL has a more in-depth understanding ... Don't say much nonsense, walk!

The steps are as follows:

First, compile and install two MySQL, the steps are as follows

Download MySQL here, take mysql-6.0.11-alpha.tar.gz as an example

Install the first database (primary database)

(The Red part is the default database file path, can be changed to other such as: data, VAR, etc.)

Tar zxvf mysql-6.0.11-alpha.tar.gz

Cdmysql-6.0.11-alpha

./configure--prefix=/usr/local/mysql--sysconfdir=/usr/local/mysql/etc--with-tcp-port=3306--localstatedir=/usr/ local/mysql/localstate--with-unix-socket-path=/tmp/mysql3306.sock--with-charset=utf8--with-collation= Utf8_general_ci--with-extra-charsets=gbk,gb2312,binary--enable-thread-safe-client--with-plugins=innobase-- With-mysqld-user=mysql--with-charset=utf8--with-client-ldflags=-all-static--with-mysqld-ldflags=-all-static

Make &&make Install

Install a second database (from the database)

Tar zxvfmysql-6.0.11-alpha.tar.gz

Cdmysql-6.0.11-alpha

./configure--prefix=/usr/local/mysql3307--sysconfdir=/usr/local/mysql3307/etc--with-tcp-port=3307-- localstatedir=/usr/local/mysql3307/localstate --with-unix-socket-path=/tmp/ Mysql3307.sock--with-charset=utf8--with-collation=utf8_general_ci--with-extra-charsets=gbk,gb2312,binary-- Enable-thread-safe-client--with-plugins=innobase--with-mysqld-user=mysql--with-charset=utf8-- With-client-ldflags=-all-static--with-mysqld-ldflags=-all-static

Make &&make Install

To support all character set modifications to:--with-extra-charsets= all can be

Second, initialize the database script separately (under the compilation Directory execution)

scripts/mysql_install_db--basedir=/usr/local/mysql/--user=mysql

scripts/mysql_install_db--basedir=/usr/local/mysql3307/--user=mysql

Note: The--datadir=path parameter can be used to specify the database file path, which defaults to compile-time-localstatedir

Third, modify the configuration file from the library

Copy the configuration file:

Cp/usr/local/software/mysql-6.0.11-alpha/support-files/my-medium.cnf/usr/local/mysql/etc/my.cnf

Cp/usr/local/software/mysql-6.0.11-alpha/support-files/my-medium.cnf/usr/local/mysql3307/etc/my.cnf

Iv. modifying MY.CNF files for each database

The main contents are as follows:

Add InnoDB Support:

[Client]

#password =your_password

Port = 3307-- database port number

Socket = /tmp/mysqls.sock--sock file path

Default-character-set=utf8 -- client UTF8 connection

[Mysqld]

Port = 3307-- database port number

Socket = /tmp/mysqls.sock--sock file path

Default-storage-engine=innodb

Default-character-set=utf8 -- default character Set

init_connect= ' setnames UTF8 ' -- with UTF8 connection

Skip-name-resolve -- Canceling DNS reverse parsing

Lower_case_table_names=1 -- not distinguishing between table name and case

Start the database (enter the respective directory)

Main:./mysqld_safe&

From:./mysqld_safe&

Configure turn on automatically:

Cp/usr/local/software/mysql-6.0.11-alpha/support-files/mysql.server/etc/init.d/mysql

cp/usr/local/software/mysql-6.0.11-alpha/support-files/mysql.server/etc/init.d/mysql3307

Modify Basedir and DataDir in/etc/init.d/mysql3007 to be able

basedir=/usr/local/mysql3307
Datadir=/usr/local/mysql3307/var

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/93/7C/wKioL1kK7JzRx4fzAAAIjDDrpso844.png "Title=" 000. PNG "alt=" Wkiol1kk7jzrx4fzaaaijddrpso844.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/93/7D/wKiom1kK7KWDeJ0jAAAoJMpYgBU351.png "title=" 001. PNG "alt=" Wkiom1kk7kwdej0jaaaojmpygbu351.png "/>

Stopping the database

Main:./mysqladminshutdown

From:./mysqladminshutdown

Each of these configurations can be modified to suit your business needs.


This article is from the IT Technology Solutions blog, so be sure to keep this source http://wyait.blog.51cto.com/12674066/1922119

Linux build MySQL Master service

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.