MySQL multi-instance installation starts

Source: Internet
Author: User

This installation was built on the basis of the success of the last mysql3306 installation http://liyingdi.blog.51cto.com/6397405/1879993

Tips: One of our previous examples is mysql3306, we now install a mysql3307

1. Create the required directory folder as before

Mkdir-p/data/mysql/mysql3307/{data,logs,tmp}

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8C/0D/wKiom1hgi1igIu5RAAAJIgwFqSM392.png-wh_500x0-wm_3 -wmp_4-s_3123821989.png "title=" A.png "alt=" Wkiom1hgi1igiu5raaajigwfqsm392.png-wh_50 "/>

Authorize files when they are created

Chown-r mysql:mysql/data/mysql/mysql3307/

2. Enter mysql3307

cd/data/mysql/mysql3307/

3. Copy the previous my.cnf file

CP/ETC/MY.CNF my3307.cnf

4. Modify the MY3307.CNF configuration file

Sed-i ' s/3306/3307/g ' my3307.cnf

Change the previous 3306 to 3307 first

Add sockets and Users

socket=/tmp/mysql3307.sock

user = MySQL

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/8C/0A/wKioL1hgl9OS1iecAABIpWKKgr8642.png-wh_500x0-wm_3 -wmp_4-s_618898851.png "title=" A.png "alt=" Wkiol1hgl9os1iecaabipwkkgr8642.png-wh_50 "/>

5. Copy mysql3306 's/data directly

CP data/*-R. /mysql3307/data/

6. Delete some files

Remove AUTO.CNF error.log Slow.log

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/8C/09/wKioL1hgjk6RlsAZAABQnUmyCYM347.png-wh_500x0-wm_3 -wmp_4-s_368141322.png "title=" A.png "alt=" Wkiol1hgjk6rlsazaabqnumycym347.png-wh_50 "/>

7. You can start the 3307 instance.

/usr/local/mysql/bin/mysqld--DEFAULTS-FILE=/DATA/MYSQL/MYSQL3307/MY3307.CNF &


8. Startup success

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8C/0D/wKiom1hgmATRh9GYAAAbcYq3sug457.png-wh_500x0-wm_3 -wmp_4-s_390842523.png "title=" A.png "alt=" Wkiom1hgmatrh9gyaaabcyq3sug457.png-wh_50 "/>

9. Go to MySQL

Mysql-s/tmp/mysql3307.sock-uroot-p

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8C/0A/wKioL1hgmEKhQOJ9AAAub6Co1xs224.png-wh_500x0-wm_3 -wmp_4-s_3306729474.png "title=" A.png "alt=" Wkiol1hgmekhqoj9aaaub6co1xs224.png-wh_50 "/>

PS: It is important to note that we are using the socket to enter the 3307 instance, because we are copying the previous 3306, so the password is consistent with the 3306 password

10 now go and start our 3306.

CP config file to 3306 cp/etc/my.cnf my3306.cnf

11. Modify the Configuration profile

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8C/0E/wKiom1hgmPzCv_1MAAAw4uxOV9s783.png-wh_500x0-wm_3 -wmp_4-s_3577003358.png "title=" A.png "alt=" Wkiom1hgmpzcv_1maaaw4uxov9s783.png-wh_50 "/>

12. Launch 3306 Instances

/usr/local/mysql/bin/mysqld--DEFAULTS-FILE=/DATA/MYSQL/MYSQL3306/MY3306.CNF &

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8C/0A/wKioL1hgmiHQmIRkAAEqqRstDzE451.png-wh_500x0-wm_3 -wmp_4-s_2320800173.png "style=" Float:none; "title=" A.png "alt=" Wkiol1hgmihqmirkaaeqqrstdze451.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8C/0A/wKioL1hgmiKjzwjpAAArqErU7Yg116.png-wh_500x0-wm_3 -wmp_4-s_620077368.png "style=" Float:none; "title=" B.png "alt=" Wkiol1hgmikjzwjpaaarqeru7yg116.png-wh_50 "/>

13 Now we start up two instances and verify if 3306 can get in.

Mysql-s/tmp/mysql3306.sock-uroot-p

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8C/0E/wKiom1hgmlzSCow1AAAsu075hJE249.png-wh_500x0-wm_3 -wmp_4-s_2642560317.png "title=" A.png "alt=" Wkiom1hgmlzscow1aaasu075hje249.png-wh_50 "/>


Summary: MySQL Double instance has already started up, when MySQL starts, must notice, the best not to use root to start, with own creation MySQL user is good.

PS: Next time to write about how to start a two (this time, or start the MySQL instance separately)

MySQL multi-instance installation starts

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.