MySQL database multi-instance configuration

Source: Internet
Author: User
Tags chmod

----------------------------------------------------------------

MySQL 5.5.48

-----------------------------------------------------------------

1 Creating a database file

Mkdir-p/usr/local/mysql/data/3306

Mkdir-p/usr/local/mysql/data/3307

Mkdir-p/usr/local/mysql/data/3308


Chown-r mysql:mysql/usr/local/mysql/data/3306

Chown-r mysql:mysql/usr/local/mysql/data/3307

Chown-r mysql:mysql/usr/local/mysql/data/3308

2 Initializing the database

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/3306--user= Mysql

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/3307--user= Mysql

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/3308--user= Mysql

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/87/4A/wKioL1fbfNuTCR8SAAAaUV8RpL4983.png "title=" 11.png "alt=" Wkiol1fbfnutcr8saaaauv8rpl4983.png "/>

This represents success under the file.

3 Copy the MySQL configuration file

Cp/usr/local/mysql/support-files/my-huge.cnf/usr/local/mysql/data/3306/my.cnf

Cp/usr/local/mysql/support-files/my-huge.cnf/usr/local/mysql/data/3307/my.cnf

Cp/usr/local/mysql/support-files/my-huge.cnf/usr/local/mysql/data/3308/my.cnf

4 Modifying configuration files Vim my.cnf

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/4A/wKioL1fbfuLAn6t4AABTOwT4zcE618.png "title=" 12.png "alt=" Wkiol1fbfulan6t4aabtowt4zce618.png "/>

Modify the other ports as well

5 Copy the MySQL boot file to/etc/init.d/below

cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql3306

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

cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql3308

6 Assigning permissions to MySQL

chmod 755/etc/init.d/mysql3306

chmod 755/etc/init.d/mysql3307

chmod 755/etc/init.d/mysql3308

7 Modifying the Startup file vi/etc/init.d/

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/4A/wKioL1fbginQe90RAABLVmiT1k8513.png "style=" float: none; "title=" 13.png "alt=" Wkiol1fbginqe90raablvmit1k8513.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/4C/wKiom1fbgimzD9waAAAxKfNSkQ0156.png "style=" float: none; "title=" 14.png "alt=" Wkiom1fbgimzd9waaaaxkfnskq0156.png "/>

Other ports are similarly modified

8 then start each MySQL instance

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/87/4A/wKioL1fbhoGDQihtAADV8emOsV8186.png "title=" 16.png "alt=" Wkiol1fbhogdqihtaadv8emosv8186.png "/>

9 then add the user password

/usr/local/mysql/bin/mysqladmin-uroot Password Lampol-s/tmp/mysql3306.sock

/usr/local/mysql/bin/mysqladmin-uroot Password Lampol-s/tmp/mysql3307.sock

/usr/local/mysql/bin/mysqladmin-uroot Password Lampol-s/tmp/mysql3308.sock

10 to specify sock when logging in

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/4A/wKioL1fbhb_i_262AABeLY1GHkc690.png "title=" 15.png "alt=" Wkiol1fbhb_i_262aabely1ghkc690.png "/>

Okay, MySQL. Multiple instances are now configured.

This article is from the "Ideal for Life" blog, please be sure to keep this source http://lampol.blog.51cto.com/11662628/1853094

MySQL database multi-instance configuration

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.