MySQL Getting Started 02-mysql binary version Quick Deploy

Source: Internet
Author: User

In the previous article MySQL primer 01-mysql source installation, we introduced the MySQL source installation method.
The source installation has many advantages, such as more flexibility and optimization. However, the process of compiling and installing the source code is relatively complex and the whole process takes a long time.
For a complete set of systems and hardware exactly the same machine, in fact, can be installed only in one machine source code, and then packaged the compiled binary version, copied to other machine decompression, direct configuration can be.

This article will cover the entire process of installing a binary version of MySQL configuration.

    • 1. Upload binary version
    • 2. Planning Data Storage Directory
    • 3. Unzip the binary version of MySQL
    • 4. Adding groups and users
    • 5. Configure limits.conf
    • 6. Modify the directory Owner
    • 7. Configure Environment variables
    • 8. Create a database service
1. Upload binary version

First of all, in the previous article in 5.1, the packaged MySQL binary version is mysql-5.6.30.tar.gz uploaded to the/USR2 directory.
Note: The binary version of the compressed package has more than 200m+ size.

2. Planning Data Storage Directory

Here the system is managed using LVM, VG name vg00, add a lv named Lvdata, size set 100G, and then in the system to create/data directory, the new Lvdata mounted to the/data directory. Here's how:

--创建lvdatalvcreate -L 100g -n lvdata vg00--格式化为ext4文件系统mkfs.ext4 /dev/mapper/vg00-lvdata--添加为开机自动挂载的目录vi /etc/fstab 加入一行:/dev/mapper/vg00-lvdata /data ext4 defaults 1 2--创建/data目录并挂载mkdir -p /data && mount -a
3. Unzip the binary version of MySQL

To switch to the root directory, unzip the binary version of MySQL:

cd / && tar zxvf /usr2/mysql-5.6.30.tar.gz
4. Adding groups and users

Add the group MySQL and user mysql:

groupadd mysqluseradd -g mysql mysql
5. Configure limits.conf

Vi/etc/security/limits.conf, add at the end of the file:

mysql   soft    nproc   2047mysql   hard    nproc   16384mysql   soft    nofile  1024mysql   hard    nofile  65536
6. Modify the directory Owner

Modify the directory owner of the MySQL software:

chown -R mysql.mysql /usr/local/mysql
7. Configure Environment variables

Configure environment variables for MySQL users:
Need to su - mysql switch to MySQL user,
VI ~/.bash_profile

export LANG=zh_CN.GB18030export PATH=/usr/local/mysql/bin:$PATH
8. Create a database service

8.1 Prepare before creating:

# mkdir -p /data/mysqldata/{3306/{data,tmp,binlog},backup,scripts}# chown -R mysql.mysql /data/mysqldata# su - mysql$ vi /data/mysqldata/3306/my.cnf

The contents of the MY.CNF configuration file for 8.2 MySQL are as follows:

[Client]port = 3306socket =/data/mysqldata/3306/mysql.sock#The MySQL server[mysqld]port = 3306user = Mysqlsocket =/data/mysqldata/3306/mysql.sockpid-file =/data/mysqldata/3306/ Mysql.pidbasedir =/usr/local/mysqldatadir =/data/mysqldata/3306/datatmpdir =/data/mysqldata/3306/tmpopen_files_ Limit = 10240explicit_defaults_for_timestampsql_mode = No_engine_substitution,strict_trans_tables#Buffermax_allowed_packet = 256mmax_heap_table_size = 256mnet_buffer_length = 8ksort_buffer_size = 2mjoin_buffer_ Size = 4mread_buffer_size = 2mread_rnd_buffer_size = 16M#Loglog-bin =/data/mysqldata/3306/binlog/mysql-binbinlog_ Cache_size = 32mmax_binlog_cache_size = 512mmax_binlog_size = 512mbinlog_format = Mixedlog_output = FILElog-error =: /mysql-error.logslow_query_log = 1slow_query_log_file =. /slow_query.loggeneral_log = 0general_log_file =. /general_query.logexpire-logs-days =#InnoDBinnodb_data_file_path = Ibdata1:2048m:autoextendinnodb_log_file_ Size = 256minnodb_log_files_in_group = 3innodb_buffer_pool_size = 1024m[mysql]no-auto-rehashprompt = (\[email protected ]\h) [\d]>\_default-character-set = GBK  

8.3 Initialize MySQL database:

/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data --basedir=/usr/local/mysql

8.4 Start the database service:

mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf &

Summary: in fact, after the configuration of the binary version of MySQL found that the whole process with the source installation is no different, just save the most troublesome and time-consuming MySQL source compilation and installation process. Ideal for fast deployment of MySQL services for the same hardware and systems.

Ext.: http://www.cnblogs.com/jyzhao/p/5551166.html

MySQL Getting Started 02-mysql binary version Quick Deploy

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.