centos6原始碼安裝mysql5 6 16

2021-10-10 21:34:09 字數 2673 閱讀 7868

一、建立資料庫所需目錄

mkdir -p /data/mysql &&

chown mysql.mysql /data/mysql

mkdir -p /etc/my.cnf.d/

mkdir -p /var/log/mysql &&

touch /var/log/mysql/mysqld.log &&

chown mysql.mysql /var/log/mysql

mkdir -p /var/run/mysqld &&

touch /var/run/mysqld/mysql.sock &&

touch /var/run/mysqld/mysqld.pid &&

chown mysql.mysql /var/run/mysqld

wget
三、安裝依賴

yum -y install

make gcc-c++ cmake bison-devel ncurses-devel gcc autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel*

四、編譯安裝

tar xvf mysql-5.6.16.tar.gz 

cd mysql-5.6.16

cmake -dcmake_install_prefix=/usr/local/mysql \

-dmysql_datadir=/data/mysql \

-dsysconfdir=/etc \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_partition_storage_engine=1 \

-denabled_local_infile=1 \

-denabled_profiling=1 \

-dwith_debug=0 \

-ddownload_boost=1;

make -j `

grep processor /proc/cpuinfo |

wc -l`

&&make

install

五、設定開機啟動

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld &&

chmod a+x /etc/init.d/mysqld &&

chkconfig --add mysqld &&

chkconfig mysqld on

六、初始化配置

cd /usr/local/mysql

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

七、編輯配置檔案

vim /etc/my.cnf

[mysqld]

bind-address=0.0.0.0

port=3306

datadir=/data/mysql

socket=/data/mysql/mysql.sock

user=mysql

skip-name-resolve

slow_query_log=on

long_query_time=5

slow_query_log_file=/data/mysql/mysql-slow.log

expire_logs_days=15

innodb-file-per-table=1

max_connections = 1000

innodb_flush_log_at_trx_commit = 2

log_warnings = 1

connect_timeout = 60

net_read_timeout = 120

performance_schema_max_table_instances = 400

[mysqld_safe]

log-error=/data/mysql/mysqld.log

pid-file=/data/mysql/mysqld.pid

八、設定許可權

chown mysql.mysql /data/mysql/
九、啟動mysql

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

chkconfig mysqld on

service mysqld start

十、修改密碼

mysql -uroot

mysql> set password = password(

'123456');

flush privileges;

centos6原始碼編譯安裝mysql

建立mysql使用者 useradd r mysql 安裝依賴包 yum y install gcc gcc c ncurses devel cmake 編譯有乙個warning bison executable not found in path 可以繼續安裝不影響使用 可以通過yum y ins...

centos6原始碼編譯安裝nginx

2.安裝依賴包 yum install y gcc gcc c autoconf automake zlib zlib devel openssl openssl devel pcre pcre devel libevent devel 3.建立nginx執行使用者 groupadd r nginx...

CentOS 6原始碼編譯安裝MySQL5 6

說明 mysql5.6版本預設安裝目錄就是 usr local mysql。root localhost mysql 5.6.19 make root localhost mysql 5.6.19 make install 新建mysql資料檔案目錄 root localhost mysql mkd...