How to add another instance of MySQL on a multi-instance basis

Source: Internet
Author: User

1) The directory required to create the data file

# mkdir-p/data/3308/data# cp/data/3306/my.cnf/data/3308# cp/data/3306/mysql/data/3308

2) Configure permissions

# chown mysql.mysql/data/3308-r# chown root.root/data/3308/mysql # chmod 700/data/3308/mysql

3) Modify the data configuration file and startup script

# sed-i ' s/3306/3308/g '/data/3308/my.cnf# sed-i ' S/server-id = 1/server-id = 8/g '/data/3308/my.cnf # cat My.cnf | grep idpid-file =/data/3308/mysql.pidserver-id = 8pid-file=/data/3308/mysqld.pid# sed-i ' s/3306/3308/g '/data/3308/ mysql# cd/application/mysql/scripts/#./mysql_install_db--datadir=/data/3308/data--basedir=/application/mysql-- user=mysql#/data/3308/mysql startstarting mysql...# Echo $?0

4) Check the operation of the database

# netstat -tunlp | grep 330*tcp        0       0 0.0.0.0:3306                 0.0.0.0:*                    listen      4052/ mysqld         tcp         0      0 0.0.0.0:3307                 0.0.0.0:*                    LISTEN       4048/mysqld         tcp         0      0 0.0.0.0:3308                 0.0.0.0:*                    listen      5502/mysqld

5) Configure the database to boot automatically

# echo "/data/3308/mysql start" >>/etc/rc.local# tail-4/etc/rc.local The results shown are as follows: # MySQL Multi instances startup/data/ 3306/mysql start/data/3307/mysql start/data/3308/mysql Start

6) Initializing the database

Set MySQL initial password: # mysqladmin-u root-s/data/3308/mysql.sock password ' redhat12345 ' # mysql-u root-s/data/3308/mysql.sock-  Predhat12345welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.5.32-log Source distributioncopyright (c), +, Oracle and/or I TS affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.


This article is from the "Frozen vs watermelon" blog, so be sure to keep this source http://molewan.blog.51cto.com/287340/1860235

How to add another instance of MySQL on a multi-instance basis

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.