您的位置:首页 > 运维架构 > Linux

centos6.x源码编译安装mysql5.6

2017-01-20 00:00 477 查看
yum install gcc gcc-c++ ncurses-devel perl

wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make && make install

wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz tar zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make
make install
groupadd mysql
adduser -g mysql mysql
chown -R mysql.mysql /usr/local/mysql/

cd /usr/local/mysql-5.5
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
make && make install

cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/usr/local/data
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --collation-server=utf8_general_ci

cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

vi /etc/my.ini
[mysqld]
datadir = /data/mysql
socket = /tmp/mysql.sock
pid-file = /data/logs/mysql/mysql.pid
user = mysql
port = 3306
default_storage_engine = InnoDB
# InnoDB
#innodb_buffer_pool_size = 128M
#innodb_log_file_size = 48M
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
# MyISAM
#key_buffer_size = 48M
# character-set
character-set-server=utf8
collation-server=utf8_general_ci
# name-resolve
skip-host-cache
skip-name-resolve
# LOG
log_error = /data/logs/mysql/mysql-error.log
long_query_time = 1
slow-query-log
slow_query_log_file = /data/logs/mysql/mysql-slow.log
# Others
explicit_defaults_for_timestamp=true
#max_connections = 500
open_files_limit = 65535
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
socket = /tmp/mysql.sock
port = 3306

vi /etc/profile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
service mysqld start

chkconfig --level 35 mysqld on

grant all privileges on *.* to root@"%" identified by '123456' with grant option;
flush privileges;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MySQL