重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

MySQL源码安装-创新互联

1,下载源码安装包

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

目前创新互联公司已为近1000家的企业提供了网站建设、域名、网站空间、网站托管、服务器租用、企业网站设计、湟源网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

/tupian/20230522/                   5.5后版本需用cmake编译

mysql-5.7 需要

-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  磁盘扩容文件系统为xfs 最后LV扩容后重新识别使用xfs_growfs

2,解压安装.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,建用户和目录

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,设置用户系统资源限制

 vi  /etc/security/limits.conf

mysql                   soft               nproc           2047

mysql                   hard              nproc            16384

mysql                  soft               nofile            1024

mysql                   hard              nofile            65536

 

5,初始化参数文件

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,初始化MYSQL数据库

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

 

7,启动数据库服务

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

service  mysql  start  #若启动不成功,查看是哪个my.cnf启动的

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


当前标题:MySQL源码安装-创新互联
链接分享:http://cqcxhl.com/article/ddojei.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP