操做系統是centos 6.5 yum install gcc gcc-c++ cmake ncurses-develhtml
到搜狐鏡像站( http://mirrors.sohu.com/mysql/MySQL-5.5/ )下載mysql源碼java
解壓 tar -xzvf mysql-5.5.46.tar.gz -Cbuildmysql
編譯 因爲使用了cmake進行編譯c++
cd build/mysql-5.5.46 cmake . \ -DCMAKE_INSTALL_PREFIX=$HOME/local/mysql-5.5.46 \ #指定安裝目錄 -DWITH_INNOBASE_STORAGE_ENGINE=1 \ #安裝innodb存儲引擎 -DENABLED_LOCAL_INFILE=1 \ #容許從本地導入數據 -DDEFAULT_CHARSET=utf8mb4 \ #使用utf8mb4字符 -DDEFALUT_CHARSETS=all \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ #安裝blackhole存儲引擎 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ #安裝archive存儲引擎 -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DWITH_DEBUG=0 make make install
[client] port = 14010 socket = /home/mysql/local/mysql-5.5.46/tmp/mysql.sock default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4' port = 14010 socket = /home/mysql/local/mysql-5.5.46/tmp/mysql.sock user = dove skip-external-locking datadir = /home/mysql/local/mysql-5.5.46/data/ log-error = /home/mysql/local/mysql-5.5.46/log/mysqld.err pid-file = /home/mysql/local/mysql-5.5.46/bin/mysql.pid key_buffer_size = 64M myisam_sort_buffer_size = 30M max_allowed_packet = 16M table_open_cache = 4096 sort_buffer_size = 5M join_buffer_size = 5M read_buffer_size = 5M read_rnd_buffer_size = 8M bulk_insert_buffer_size = 64M query_cache_size = 0 query_cache_limit=1M query_cache_min_res_unit = 2k tmp_table_size=64M max_heap_table_size = 128M expire_logs_days=1 open_files_limit=1024 thread_concurrency = 16 max_connections=3000 max_connect_errors=3000 back_log = 600 table_cache = 4096 thread_cache_size = 100 thread_stack = 192K skip-name-resolve ####log variables server-id = 1 binlog_format=mixed #log-slave-updates log-bin=/home/mysql/local/mysql-5.5.46/log/mysql-bin relay_log=/home/mysql/local/mysql-5.5.46/log/relay-bin max_binlog_size = 100M binlog_cache_size = 8M max_binlog_cache_size = 640M #binlog-ignore-db = mysql replicate-ignore-db = mysql expire-logs-days = 10 sync_binlog=100 ##############slave config#################### #report-host=192.168.3.172 #report-port=19817 #report-user=rep #report-password=rep ##############slave config#################### slow_query_log=1 slow_query_log_file=/home/mysql/local/mysql-5.5.46/log/slowquery.log long_query_time=1 general_log=1 general_log_file=/home/mysql/local/mysql-5.5.46/log/general.log #relay_log_purge=OFF # Point the following paths to different dedicated disks tmpdir = /home/mysql/local/mysql-5.5.46/tmp/ #log-update = /path-to-dedicated-directory/hostname #auto_increment_increment=1s #auto_increment_offset=asdafs ####innodb variables #skip-innodb innodb_data_home_dir = /home/mysql/local/mysql-5.5.46/data innodb_data_file_path = ibdata:100M:autoextend innodb_log_group_home_dir = /home/mysql/local/mysql-5.5.46/log #innodb_log_arch_dir = /home/mysql/local/mysql-5.5.46/data/ innodb_buffer_pool_size = 1000M innodb_additional_mem_pool_size = 8M innodb_log_file_size = 100M #innodb_log_buffer_size = 128M innodb_log_buffer_size = 8M innodb_log_files_in_group = 3 innodb_flush_log_at_trx_commit = 2 #innodb_file_io_threads = 4 innodb_thread_concurrency = 40 default-storage-engine=innodb innodb_max_dirty_pages_pct = 50 #innodb_lock_wait_timeout = 60 innodb_file_per_table = 1 interactive_timeout = 60 wait_timeout = 60 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 512M sort_buffer_size = 512M read_buffer = 5M write_buffer = 5M [mysqlhotcopy] interactive-timeout
mkdir data log tmp cd ~/local/mysql-5.5.46 scripts/mysql_install_db --defaults-file=$HOME/local/mysql-5.5.46/my.cnf --user=dove --basedir=$HOME/local/mysql-5.5.46
bin/mysqld_safe --defaults-file=$HOME/local/mysql-5.5.46/my.cnf --basedir=$HOME/local/mysql-5.5.46 &
bin/mysql -u root -S$HOME/local/mysql-5.5.46/tmp/mysql.sock
mysql> grant all privileges on *.* to 'dove'@'%' identified by 'dove_dove@201512041013' with grant option; mysql> FLUSH PRIVILEGES;
#!/bin/sh COMMAND="start"; HELP="no"; while getopts 'c:h' opt do case $opt in c)COMMAND=$OPTARG;; h)HELP='yes';; esac done if [ $HELP = 'yes' ] || [ $COMMAND = "" ] then echo "" echo "=========================================================================" echo "*example: ./mysql.sh -c start *" echo "* -s: to start or shutdown MySql Server, default is start *" echo "* There are 2 commands as follows: *" echo "* start: to start MySql Server *" echo "* stop: to shutdown MySql Server *" echo "=========================================================================" echo "" exit 0 fi if [ $COMMAND == "start" ] then $HOME/local/mysql-5.5.46/bin/mysqld_safe --defaults-file=$HOME/local/mysql-5.5.46/my.cnf --basedir=$HOME/local/mysql-5.5.46 --ledir=$HOME/local/mysql-5.5.46/bin >/dev/null 2>&1 & fi if [ $COMMAND == "stop" ] then $HOME/local/mysql-5.5.46/bin/mysqladmin -h127.0.0.1 -P14010 -uroot shutdown fi
http://www.itokit.com/2012/0425/73648.htmlsql
http://www.itokit.com/2012/0425/73648.htmlsegmentfault
http://www.blogjava.net/kelly859/archive/2012/09/04/387005.htmlcentos
http://wowking.blog.51cto.com/1638252/1037609socket
http://www.cppblog.com/skyscribe/archive/2009/12/14/103208.aspxui
http://www.javashuo.com/article/p-fhfqfxxz-z.html
https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-3.html