#建立mysql使用者和mysql組
groupadd mysql
useradd -g mysql mysql
#設定使用者資源限制,在/etc/security/limits.conf檔案後增加以下內容
vi /etc/security/limits
mysql soft nproc 2047
mysql hard nproc 16384
mysql soft nofile 1024
mysql hard nofile 65536
#關閉firewalld服務和selinux
systemctl stop firewalld
vi /etc/selinux/conf
#配置mysql環境變數
su - mysql
vi .bash_profile
path=$path:$home/.local/bin:$home/bin:/mysql01/my3306/bin
source .bash_profile
#建立目錄並授權
mkdir -p /mysql01/my3306/data#存放資料的目錄
mkdir -p /mysql01/my3306/log/iblog#存放innodb日誌的目錄
mkdir -p /mysql01/my3306/log/binlog#存放bin日誌的目錄
mkdir -p /mysql01/my3306/run#存放socket套接字的目錄
mkdir -p /mysql01/my3306/tmp#存放臨時檔案目錄
#目錄結構如下:
mysql01/
└── my3306
├── data
├── log
│ ├── binlog
│ └── iblog
├── run
└── tmp
chown -r mysql:mysql /mysql01/my3306
chmod -r 755 /mysql01/my3306
#解壓mysql原始碼包
pwd
/mysql01
tar -xzvf mysql-5.6.40.tar.gz
#配置yum源,並安裝cmake及所需軟體包ncurses-devel、openssl-devel
yum install cmake ncurses-devel openssl-devel
#編譯並安裝
cd mysql-5.6.40
cmake . -dcmake_install_prefix=/mysql01/my3306 \
-dmysql_datadir=/mysql01/my3306/data \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-denabled_local_infile=on \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwith_partition_storage_engine=1 \
-dwith_perfschema_storage_engine=1 \
-dcompilation_comment='jss for mysqltest' \
-dmysql_tcp_port=3306 \
-dsysconfdir=/mysql01/my3306 \
-dmysql_unix_addr=/mysql01/my3306/run/mysql.sock
make && make install
#配置my.cnf引數檔案
cd /mysql01/my3306
vi my.cnf
[client]
port=3306
socket=/mysql01/my3306/run/mysql.sock
#the mysql server
[mysqld]
port=3306
user=mysql
socket=/mysql01/my3306/run/mysql.sock
pid-file=/mysql01/my3306/run/mysql.pid
basedir=/mysql01/my3306
datadir=/mysql01/my3306/data
tmpdir=/mysql01/my3306/tmp
#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
#binlog
log-bin=/mysql01/my3306/log/binlog/mysql-bin
binlog_cache_size=32m
max_binlog_cache_size=512m
max_binlog_size=512m
binlog_format=mixed
log_output=file
log-error=/mysql01/my3306/log/mysql-error.log
slow_query_log=1
slow_query_log_file=/mysql01/my3306/log/slow_query.log
general_log=1
general_log_file=/mysql01/my3306/log/general_query.log
expire-logs-days=14
#iblog
innodb_data_file_path=ibdata1:2048m:autoextend
innodb_log_file_size=256m
innodb_log_files_in_group=3
innodb_buffer_pool_size=1024m
[mysqld_safe]
datadir=/mysql01/my3306/data
#初始化mysql資料庫
chmod -r mysql:mysql /mysql01/my3306
cd /mysql01/my3306/scripts
./mysql_install_db --defaults-file=/mysql01/my3306/my.cnf --datadir=/mysql01/my3306/data --basedir=/mysql01/my3306 --user=mysql
#啟動mysql服務
/bin/mysqld_safe --defaults-file=/mysql01/my3306/my.cnf --user=mysql &
#登入mysql驗證
su - mysql
mysql
學習筆記,僅供參考!歡迎指正
mysql5 6原始碼 mysql5 6原始碼部署
一.準備環境 環境 centos 7.3 一台 軟體版本 mysql 5.6.39 1.安裝依賴 yum y install autoconf libaio bison ncurses devel 2.建立使用者 groupadd mysql useradd g mysql s sbin nolog...
mysql 5 6 原始碼 mysql5 6原始碼安裝
os環境centos6.3 yum y install gcc gcc c gcc g77 autoconf automake zlib fiex libxml ncurses libmcrypt libtool ltdl devel make cmake 必要軟體包安裝 useradd mysql...
MySQL 5 6原始碼安裝
1 解決依賴關係 yum y install cmake bison git ncurses devel gcc gcc c 2 進入到 usr local src cd usr local srcwget4 檢視mysql的大小 解壓 du sh mysql 5.6.39 linux glibc2...