Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL source code installation

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Download the source code installation package

Http://dev.mysql.com/downloads/mysql/ Source Code

Post-5.5 versions of https://cmake.org/download/ need to be compiled with cmake

Mysql-5.7 needs

-DDOWNLOAD_BOOST=1\

-DWITH_BOOST=/data/boost_1_59_0

Yum install-y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

CentOS7 disk expansion file system for xfs after the final LV expansion, re-identify the use of xfs_growfs2, decompress and install .tar.gz

Tar zxvf cmake-3.4.1.tar.gz

Cd cmake-3.4.1

. / configure

Make

Make install

Tar-xvfz mysql-5.6.28.tar.gz

Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATED_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\

-DWITH_PARITION_STORAGE_ENGINE=1\

-DWITH_READLINE=ON\

-DEXTRA_CHARSETS=all\

-DMYSQL_DATADIR=/usr/local/mysql/data\

-DSYSCONFDIR=/data/3306\

-DMYSQL_UNIX_ADDR=/data/3306/mysql.sock\

-DENABLED_LOCAL_INFILE=1

Make & & make install

3. Create users and directories

Groupadd mysql

Useradd-r-g mysql mysql

Mkdir-p / usr/local/mysql

Chown-R mysql:mysql / usr/local/mysql

Mkdir-p / usr/local/mysql/data

Mkdir-p / data/ {3306 / {data,tmp,binlog}, backup,scripts}

Chown-R mysql:mysql / data

4. Set the user system resource limit

Vi / etc/security/limits.conf

Mysql soft nproc 2047

Mysql hard nproc 16384

Mysql soft nofile 1024

Mysql hard nofile 65536

5, initialize the parameter file

Vi / data/3306/my.cnf

[client]

Port = 3306

Socket = / data/3306/mysql.sock

# The MYSQL SERVER

[mysqld]

Port = 3306

User = mysql

Server-id = 111111

Socket = / data/3306/mysql.sock

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

Basedir = / usr/local/mysql

Datadir = / data/3306/data

Tmpdir = / data/3306/tmp

Open_files_limit = 10240

Explicit_defaults_for_timestamp

Sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# BUFFER

Max_allowed_packet = 256m

Max_heap_table_size = 256m

Net_buffer_length = 8K

Sort_buffer_size = 2m

Join_buffer_size = 4m

Read_buffer_size = 2m

Read_rnd_buffer_size = 16m

# log

Log-bin = / data/3306/binlog/mysql-bin

Binlog_cache_size = 32m

Max_binlog_cache_size = 512m

Max_binlog_size = 512m

Binlog_format = mixed

Log_output = FILE

Log-error =.. / mysql-error.log

Slow_query_log = 1

Slow_query_log_file =.. / slow_query.log

General_log = 0

General_log_file =.. / general_query.log

Expire-logs-days = 14

# InnoDB

Innodb_data_file_path = ibdata1:2048M:autoextend

Innodb_log_file_size = 256m

Innodb_log_files_in_group = 3

Innodb_buffer_pool_size = 1024m

[mysql]

No-auto-rehash

Prompt = (\ u @\ h) [\ d]\ _

Default-character-set = utf8

6. Initialize the MYSQL database

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

7, start the database service

Cp support-files/mysql.server / etc/init.d/mysql

Service mysql start # if the startup is not successful, check which my.cnf started it

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report