User Directory compiled MySQL source code, the implementation of single-host installation of multiple MySQL instances

Source: Internet
Author: User
Tags file permissions

1. Create a user directory for MySQL installation: Useradd mysql_1; passwd Mysql_1;

2. Create folder Setup:su-mysql_1 in the absence of Mysql_1 directory; mkdir setup;

3. Download the downloaded MySQL source mysql_1 User: CD setup; TAR-ZXVF mysql-5.7.22.tar.gz;

4. Modify the source directory and file permissions, set mysql_1 all files and folders Owner:mysql_1:mysql_1
Chown Mysql_1.mysql_1 *-R

5. Create the necessary path in the Mysql_1 directory, including the configuration file path ~/etc, data directory ~/data

6. Compile with CMake (if no cmake required):











7. If there is an error in the boost version, you need to install a matching version of boost. Make sure that CMake is thrown without errors.

For example, if the desired version is 1.59.0, then download:

wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
Create the directory/usr/local/boost and extract the boost1.59.0 compressed treasure into this directory, specifying the boost path in the CMake process:

1cmake-dcmake_install_prefix=/home/mysql_1/2-dmysql_datadir=/home/mysql_1/Data3-dsysconfdir=/home/mysql_1/etc4-dmysql_unix_addr=/home/mysql_1/bin/Mysql1.sock5-dwith_myisam_storage_engine=1  6-dwith_innobase_storage_engine=1  7-dwith_memory_storage_engine=1  8-dwith_readline=1     9-denabled_local_infile=1  Ten-dwith_partition_storage_engine=1   One-dextra_charsets= All A-dwith_boost=/usr/local/boost

8. Make install? Install MySQL

9. Copy the/etc/my.cnf to the/HOME/MYSQL_1/ETC directory and configure it automatically. For example:

1 [Mysqld]3port=63014bind_address=192.168.0.1565socket=/home/mysql_1/bin/Mysqld1.sock6Datadir=/home/mysql_1/Data7Log-error=/home/mysql_1/bin/log/Mysqld1.log8pid-file=/home/mysql_1/bin/Mysql1.pid9#innodb_data_home_dir =/home/mysql_1/DataTen#innodb_log_group_home_dir =/home/mysql_1/data/Redo Onebasedir=/home/Mysql_1 AUser=Mysql_1 -  - #binlog the#server-ID=1 -#log-bin=/home/mysql_1/data/binlog/mysql-bin -#binlog_format =ROW -#relay-log=/home/mysql_1/data/relaylog/relay-bin +  A#tmpdir =/home/mysql_1/data/tmp at#secure-file-priv= -#gtid_mode = on -#enfore_gtid_consistency = on - #skip_name_resolve -  inLanguage =/home/mysql_1/share/中文版 - 

10. Add environment variable/etc/profile:export path= $PATH:/home/mysql_1/bin; Source/etc/profile Make it effective

11. Run Mysqld:mysqld--defaults-file=/home/mysql_1/etc/my.cnf &

Note: If you want to specify a configuration file to start the MySQL server process (mysqld), copying the/etc/my.cnf to a custom/HOME/MYSQL_1/ETC/MY.CNF requires specifying a profile path at mysqld startup, and the final need to add & Symbols so that the terminal does not block. Otherwise the terminal will be stuck there after it starts mysqld.

12. Check the log information (located under Mysql_1/bin/log), if you can see the last ready for connection| The source distribution word is successful. If you have any problems, note that there is an error in the profile file

13. Create a MySQL service so that you can start and stop MySQL as a service later through Mysql_service_name Start/restart/stop.

CP supports-file/mysql.service/etc/init.d/mysql_6301,
Chkconfig--add mysql chkconfig--level 2345 MySQL on
Therefore, the Open/restart/stop MySQL can be used in the following ways: mysql_6301 start/restart/stop

14. Until this installation is complete, the MySQL service runs correctly.

The log does not see any exceptions at this point, but the client may still not connect:
Execute mysql-uroot-p ' root ' ==> Access denied.
Cause: MySQL can connect, but the initialization of the password is incorrect.
Solution:
Service mysql_6301 Stop
Mysqld_safe--user=mysql_1--skip-grant-tables--skip-networking & (Skip password authorization)
Another open client, Mysql-uroot MySQL, you can come in.

View User table: Select User, host, password from Mysql.user;

Set the password to root:update user set Authentication_string=password (' root ') where user= ' root ';
Enter Exit exit

Start MySQL services: service MySQL Start
Mysql-u root-p ' root '
Successful entry into mysql!!!

User Directory compiled MySQL source code, the implementation of single-host installation of multiple MySQL instances

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.