CentOS 6.5_64bit Minimal installation environment source installation mysql-5.6

Source: Internet
Author: User


First, the operating environment

Huawei Cloud Services Centos 6.5_64bit Minimized installation Intranet IP : 10.124.156.237

Mysql-5.6.20.tar.gz



Ii. source code compilation and installation process

1. Construction of basic Environment

since the operating system is minimized, some common compilation environments are not installed, and our operating environment is intranet, so we cannot use yum sources. To solve this problem, we can purchase a temporary public IP from Huawei Cloud and the intranet IP of our server , so that we can use the Yum source to install the necessary compilation environment.

Yum-y Install gccgcc-c++ vim tree make CMake autoconf OpenSSL openssl-devel openssl-clients curlcurl-devel wget rsync exp ECT readline readline-devel Bison bison-devel pcre pcre-devel zlib-devel zlib freetype freetype-devel

    • The above code can be used for basic environment operation, not only in the process of installing MySQL .

2.mysql users and required directories

There are a lot of permissions involved in the MySQL run, so prepare for this in advance and avoid having some unnecessary permissions problems later on.

Groupadd MySQL

useradd-g MySQL MySQL

Mkdir-p/home/mysql/data/data_3306/binlog/home/mysql/data/data_3306/relay_log/home/mysql/data/data_3306/socket

Mkdir-p/home/mysql/data/data_3307/binlog/home/mysql/data/data_3307/relay_log/home/mysql/data/data_3307/socket

chown–rmysql.mysql/home/mysql/

3. source code Compilation installation

cd/usr/local/src/

Tar XF mysql-5.6.20.tar.gz

CD mysql-5.6.20

CMake.-DCMAKE_INSTALL_PREFIX=/USR/LOCAL/MYSQL-DMYSQL_DATADIR=/HOME/MYSQL/DATA-DSYSCONFDIR=/ETC-DWITH_MYISAM_ Storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_unix_ Addr=/var/lib/mysql/mysql.sock-dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_engine=1- Dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_general_ci

Make && Makeinstall

4. Initialize Settings

1) Single Instance initialization

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/home/mysql/data--user=mysql

2) Multi-instance initialization

First modify the configuration file

Vim/etc/my.cnf

[Mysqld_multi]

Mysqld =/usr/local/mysql/bin/mysqld_safe

Mysqladmin =/usr/local/mysql/bin/mysqladmin

#log =/home/mysql/data/log/mysqld_multi.log

#user = root

#password = password

[Mysqld1]

Socket =/home/mysql/data/data_3306/socket/mysql.sock

Port = 3306

Pid-file =/home/mysql/data/data_3306/3306.pid

DataDir =/home/mysql/data/data_3306

user = MySQL

Skip-name-resolve

Lower_case_table_names=1

Innodb_file_per_table=1

Back_log = 50

Max_connections = 300

Max_connect_errors =1000

Table_open_cache =2048

Max_allowed_packet =16m

Binlog_cache_size = 2M

Max_heap_table_size =64m

Sort_buffer_size = 2M

Join_buffer_size = 2M

Thread_cache_size = 64

Thread_concurrency = 8

Query_cache_size = 64M

Query_cache_limit = 2M

Ft_min_word_len = 4

Default-storage-engine= MYISAM

Thread_stack = 192K

transaction_isolation= Repeatable-read

Tmp_table_size = 64M

Log-bin=mysql-bin

Binlog_format=mixed

Slow_query_log

Long_query_time = 1

Server-id = 1

Key_buffer_size = 8M

Read_buffer_size = 2M

Read_rnd_buffer_size =2m

Bulk_insert_buffer_size= 64M

Myisam_sort_buffer_size= 128M

Myisam_max_sort_file_size= 10G

Myisam_repair_threads= 1

Myisam_recover

Innodb_additional_mem_pool_size= 16M

Innodb_buffer_pool_size= 200M

Innodb_data_file_path= Ibdata1:10m:autoextend

Innodb_file_io_threads= 8

innodb_thread_concurrency= 16

Innodb_flush_log_at_trx_commit= 1

Innodb_log_buffer_size= 16M

Innodb_log_file_size =512m

Innodb_log_files_in_group= 3

Innodb_max_dirty_pages_pct= 60

innodb_lock_wait_timeout= 120

[Mysqld2]

Socket =/home/mysql/data/data_3307/socket/mysql.sock

Port = 3307

Pid-file =/home/mysql/data/data_3307/3307.pid

DataDir =/home/mysql/data/data_3307

user = MySQL

Skip-name-resolve

Lower_case_table_names=1

Innodb_file_per_table=1

Back_log = 50

Max_connections = 300

Max_connect_errors =1000

Table_open_cache =2048

Max_allowed_packet =16m

Binlog_cache_size = 2M

Max_heap_table_size =64m

Sort_buffer_size = 2M

Join_buffer_size = 2M

Thread_cache_size = 64

Thread_concurrency = 8

Query_cache_size = 64M

Query_cache_limit = 2M

Ft_min_word_len = 4

Default-storage-engine= MYISAM

Thread_stack = 192K

transaction_isolation= Repeatable-read

Tmp_table_size = 64M

Log-bin=mysql-bin

Binlog_format=mixed

Slow_query_log

Long_query_time = 1

Server-id = 1

Key_buffer_size = 8M

Read_buffer_size = 2M

Read_rnd_buffer_size =2m

Bulk_insert_buffer_size= 64M

Myisam_sort_buffer_size= 128M

Myisam_max_sort_file_size= 10G

Myisam_repair_threads= 1

Myisam_recover

Innodb_additional_mem_pool_size= 16M

Innodb_buffer_pool_size= 200M

Innodb_data_file_path= Ibdata1:10m:autoextend

Innodb_file_io_threads= 8

innodb_thread_concurrency= 16

Innodb_flush_log_at_trx_commit= 1

Innodb_log_buffer_size= 16M

Innodb_log_file_size =512m

Innodb_log_files_in_group= 3

Innodb_max_dirty_pages_pct= 60

innodb_lock_wait_timeout= 120

[Mysqldump]

Quick

Max_allowed_packet =256m

[MySQL]

No-auto-rehash

[Myisamchk]

Key_buffer_size = 512M

Sort_buffer_size =512m

Read_buffer = 8M

Write_buffer = 8M

[Mysqlhotcopy]

Interactive-timeout

[Mysqld_safe]

Open-files-limit =8192

Next Initialize the operation:

Scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/home/mysql/data/data_3306--user=mysql

Scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/home/mysql/data/data_3307--user=mysql

5. Modifying environment Variables

This step is critical because it involves the error of not finding the My_print_defaults command at startup , but also for ease of operation at a later time.

Vim/etc/profile

add exportpath= $PATH on last line :/usr/sbin/:/usr/local/mysql/bin

Save exit Execution:source/etc/profile

6. Mysql database Start-up and shutdown

/usr/local/mysql/bin/mysqld_multi start 1,2–> mysqld_multi start

Mysqld_multi Stop 1

Mysqld_multi Stop 2

7. connection to the database

1) Local Connection:

Mysql-s/home/mysql/data/data_3306/socket/mysql.sock # First Instance connection

Mysql-s/home/mysql/data/data_3307/socket/mysql.sock # A second instance connection

2) Remote connection:

Mysql–h 10.124.156.237–p 3306–u root–p123 # Specify port number connection

Mysql–h 10.124.156.237–p 3307–u root–p123

three, single-machine multi-instance as multi-computer ' from ' setting


Iv. Summary of Errors

1. Start error

Warning:my_print_defaults command not found.

Please do sure you has this command available and

In your path. The command is available from the latest

MySQL distribution.

Abort:can ' t find command ' my_print_defaults '.

This command was available from the latest MySQL

Distribution. Please do sure you have the command

In your PATH.

Problem Resolution: Unable to find the my_print_defaults command, no environment variable is set for the sake of

Problem Solving:cp/usr/local/mysql/bin/my_print_defaults/usr/bin/

cp/usr/local/mysql/bin/mysqld_multi/usr/bin/

2. Initialize error

FATAL error:the parentdirectory for the Data directory '/home/data/data_3306 ' does not exis

If that path is really intended, please create this directory path andthen

Restart this script.

If Some other path is intended, please use the correct path whenrestarting this script.

Problem Resolution: The file directory does not exist. Did not perform step 2 of the compilation installation , or the configuration file my.cnf was incorrectly filled in

Problem solving: Configuration of environment variables

Vim/etc/profile

add exportpath= $PATH on last line :/usr/sbin/:/usr/local/mysql/bin

Save exit Execution:source/etc/profile

Check the configuration file my.cnf


This article from "Watch Dolphin" blog, declined reprint!

CentOS 6.5_64bit Minimal installation environment source installation mysql-5.6

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.