Linux under install start multiple MySQL

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

CD Mysql-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 zxvf mysql-6.0.11-alpha.tar.gz

CD Mysql-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:--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= ' SET NAMES UTF8 '--to 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

Stopping the database

Main:./mysqladmin shutdown

From:./mysqladmin shutdown

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

Copyright: Robot_g (swengineer) Welcome reprint Http://blog.csdn.net/swengineer/archive/2011/03/11/6239711.aspx

Linux under install start multiple MySQL

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.