1.cmake下载与安装
[root@test3 ~]# wgethttp://wwwNaNake.org/files/v2.8/cmake-2.8.4.tar.gz
[root@test3 ~]# tar zxvfcmake-2.8.4.tar.gz
[root@test3 ~]# cd cmake-2.8.4
[root@test3 cmake-2.8.4]# ./configure
[root@test3 cmake-2.8.4]# make;makeinstall
2.mysql依赖包的安装
[root@test3 ~]# yum -y installautomake* zlib* libxml* ncurses-devel* libgcrypt* libtool* gcc gcc-c++ autoconf*ncurses*
3.mysql下载与安装
[root@test3 ~]# mkdir/usr/local/mysql
[root@test3 ~]# mkdir -p/usr/local/mysql/tmp
[root@test3 ~]# mkdir -p/u1/mysql/data
[root@test3 ~]# mkdir -p/u1/msyql/logs
[root@test3 ~]# groupadd mysql
[root@test3 ~]# useradd -d /usr/local/mysql-s /sbin/nologin -g mysql mysql
[root@test3 ~]# wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.30.tar.gz
[root@test3 ~]# tar zxvfmysql-5.5.30.tar.gz
[root@test3 ~]# cd mysql-5.5.30
[root@test3 mysql-5.5.30]# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DSYSCONFDIR=/usr/local/mysql/etc-DMYSQL_DATADIR=/u1/mysql/data -DMYSQL_TCP_PORT=3306-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all-DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1-DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
[root@test3 mysql-5.5.30]#gmake
[root@test3 mysql-5.5.30]# makeinstall
[root@test3 mysql-5.5.30]# cd/usr/local
[root@test3 local]# chown -Rmysql.mysql mysql
[root@test3 local]# chown -Rmysql.mysql /u1/mysql
[root@test3 local]# cd mysql
[root@test3 mysql]# vim my.cnf
-------------------------------------start ----------------------------------------
[client]
port =3306
socket =/tmp/mysql.sock
loose-character-set-server = utf8
[mysqld]
connect_timeout = 20
basedir =/usr/local/mysql
datadir =/u1/mysql/data
user =mysql
bind-address =192.168.101.103
port =3306
socket =/tmp/mysql.sock
pid-file =mysql.pid
loose-character-set-server = utf8
back_log =500
event_scheduler = Off
skip-name-resolve
max_connections = 1100
max_user_connections = 200
max_connect_errors = 1000
server-id = 1633306
skip-slave-start
log_slave_update
tmpdir = /usr/local/mysql/tmp
tmp_table_size = 32M
max_heap_table_size = 64M
thread_cache_size = 64
thread_concurrency = 32
thread_stack = 192K
binlog_format = mixed
log-bin = /u1/mysql/logs/mysql-bin
max_binlog_size = 128M
slow-query-log
slow-query-log-file = mysql.slow
long_query_time = 1
log_error = error.log
myisam_sort_buffer_size = 32M
myisam_max_sort_file_size = 10G
#myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
innodb_buffer_pool_size = 2G
innodb_additional_mem_pool_size = 16M
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_log_group_home_dir = /u1/mysql/logs
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 0
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 10
innodb_support_xa = 0
log_bin_trust_function_creators = 1
innodb_file_per_table = 1
innodb_old_blocks_pct=20
innodb_change_buffering=all
innodb_purge_threads=1
innodb_purge_batch_size = 32
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_io_capacity = 200
innodb_file_format = Barracuda
performance_schema=0
[mysqldump]
quick
max_allowed_packet = 128M
[mysql]
no-auto-rehash
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit= 28192
-----------------------------------------end --------------------------------------------
[root@test3 mysql]#./scripts/mysql_install_db
--user=mysql --defaults-file=/usr/local/mysql/my.cnf
[root@test3 mysql]# cp support-files/my-medium.cnf /etc/my.cnf
[root@test3 mysql]#cp support-files/mysql.server /etc/init.d/mysqld
[root@test3 mysql]# ./bin/mysqld --defaults-file=/usr/local/mysql/my.cnf&
4.设置环境变量
[root@test3 ~]# vim/etc/profile
export PATH=$PATH:/usr/local/mysql/bin
5.问题及解决方法
5.1 ip与hostname未对应
解决:在/etc/hosts 里加入: 192.168.101.103 test3
5.2 openssl与cmake问题(2075pxake/sslNaNake)
解决:yum -y installopenssl*
在mysql二进制目录下执行:rm -rf CMakeCache.txt 和make clean
5.3 启动时ibdata1问题(InnoDB: The first specified data file ibdata1 did not exist)
解决:在/u1/mysql/data目录下rm -f ibdata1;
在/u1/mysql/log 目录下rm -rf ib_logfile*
5.4启动时端口冲突问题(Can't start server: Bind on TCP/IP port: Address already in use)
解决方法1:检查系统是否启动mysql(如果没有用上,可以kill掉)
解决方法2:修改my.cnf中的端口
5.5 创建用户的时候报错:
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
ERROR 1396 (HY000): Operation CREATE USER failed for'gitlab'@'localhost'
解决办法:mysql> drop user git@localhost;
mysql> flush privileges;
mysql>CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
编译安装参数:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html