MySQL Multi-instance

Source: Internet
Author: User

1, to resolve the dependency relationship:
Yum Install Ncurses-devel-y
Yum Install Libaio-devel-y
2, create users and groups;
Groupadd MySQL
Useradd-s/sbin/nologin-g mysql-m MySQL
3. Create profile Directory
Mkdir/data/{3306,3307}/data-p
Tree/data
/data
|--3306
| '--data
'--3307
--Data

4 directories, 0 files

4, unzip, copy the configuration file (see annex Data.zip), and authorization;
Chown-r mysql.mysql/data/
find/data/-type f-name "MySQL" | Xargs chmod +x


5. Initialize the database

cd/application/mysql/scripts/
./mysql_install_db--user=mysql--datadir=/data/3306/data/--basedir=/application/mysql/

Ok
Filling Help Tables ...
Ok

#表示成功!

    ./mysql_install_db--user=mysql--datadir=/data/3307/data/--basedir=/application         /mysql/
6, start database: /data/3306/mysql start
                 /data/3307/mysql start
          view: Ss-lnt|grep
----------------------------------------------------------- --------------------------
--------------------------------------------------------------------------------- --
7, start:
    /data/3306/mysql start                               

Starting MySQL ...
/data/3307/mysql start
Starting MySQL ...
Port view: Ss-lntup |grep MySQL

8. Boot from boot
echo "#mysql Multi Instances" >>/etc/rc.local
echo "/data/3306/mysql start" >>/etc/rc.local
echo "/data/3307/mysql start" >>/etc/rc.local

9, Login: Mysql-s/data/3306/mysql.sock
Mysql-s/data/3307/mysql.sock

10.




Note: When creating multiple instances using the multi-instance configuration file provided by the attachment, be careful to modify the port number and login password of the configuration file, and do not modify the permissions of the TMP directory.

-----------------------------------------------------------------------------------------
Troubleshooting: Slow Port lsof-i: 3306,

Observing log errors;

Look at the output returned by all the execution commands,

View/var/log/message
-------------------------------------------------------------------------------------------
Error:
141101 18:14:51 Mysqld_safe the File/usr/local/mysql/bin/mysqld
Does not exist or was not executable. Please CD to the MySQL installation
Directory and restart this script from there as follows:
./bin/mysqld_safe&
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html For more information resolution:

Solve

Sed-i ' S#/usr/local/mysql/#/application/mysql#g '/application/mysql/bin/mysqld_safe
Sed-i ' s#/application/mysql#/application/mysql/#g '/application/mysql/bin/mysqld_safe

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

If you encounter an issue with an environment variable:

W which + error

Echo $PATH

echo "Export path=/application/mysql/bin: $PATH" >>/etc/profile

./etc/profile

or cp-ap/application/mysql/bin/*/usr/local/sbin/.

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

This article from "As always" blog, declined reprint!

MySQL Multi-instance

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.