Linux boot multiple Mysql server example _mysql

Source: Internet
Author: User

1, create multiple MySQL database directory

Copy Code code as follows:
mysql_install_db--datadir=/data/mysql_3307

2, set the database directory permissions
Copy Code code as follows:

Chown–r Mysql/data

3, copy, set my.cnf
Copy Code code as follows:

CP XXX/MY.CNF/DATA/MYSQL_3307/MY.CNF

Add MY.CNF
Copy Code code as follows:

Log-error =/data/mysql_3307/localhost.localdomain.err
Pid-file =/data/mysql_3307/localhost.localdomain.pid

4. Add Startup script:
Copy Code code as follows:

#!/bin/ti
Rundir= ' pwd '
Datadir= $rundir
cnf= $rundir "/MY.CNF"

echo "Server path: $rundir"
echo "Data path: $datadir"
echo "CNF: $cnf"

/usr/local/mysql/bin/mysqld_safe/
--defaults-file= "$CNF"/
--pid-file= "$rundir"/mysql.pid/
--datadir= "$datadir"/
--socket= "$rundir"/mysql.sock/
&

5, Ok,chmod a+x my.cnf,./my.cnf, start

6, Ok, start normal, as shown in the figure above.

Problems that you may encounter:

1)/usr/local/mysql/libexec/mysqld:file './mysql-bin.index ' not Found (errcode:13)

The reason is that the 2nd step is not performed and the user group permissions are set for the database Data folder;

2 Can ' t find messagefile '/data/mysql_3307/share/mysql/english/errmsg.sys '

You need to configure the path of the language in MY.CNF and add the following: Language =/usr/local/mysql/share/mysql/english

3 MySQL is not connected to the MySQL server

Note that MySQL indicates the path to the configuration file, such as MYSQL–DEFAULTS-FILE=/DATA/MYSQL_3307/MY.CNF. You need to check that the Client.socket file is correct in the my.cnf file.

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.