by netoearth
mysql5.5 比mysql5.1有更快的innodb,更好的多核支持,加强的复制功能,这正是我看中的.
Percona-Server是MySQL的衍生版,在功能和性能上较官方MySQL 又有着很显著的提升.
Percona版和官方mysql.5.5.17下编出中文支持需用
-DWITH_EXTRA_CHARSETS=all
下面参数无法编出
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk
官方mysql.5.5.18两个参数都无法编译出中文支持…
5.5起使用cmake编译,可以用yum安装
5.6也可用此安装
- wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.17-22.1/source/Percona-Server-5.5.17-rel22.1.tar.gz
- tar zxvf Percona-Server-5.5.17-rel22.1.tar.gz
- cd Percona-Server-5.5.17-rel22.1
- CC=gcc CFLAGS=”-DBIG_JOINS=1 -DHAVE_DLOPEN=1 -O3″ CXX=g++ CXXFLAGS=”-DBIG_JOINS=1 -DHAVE_DLOPEN=1 -felide-constructors -fno-rtti -O3″
- cmake .
- -DCMAKE_BUILD_TYPE:STRING=Release
- -DSYSCONFDIR:PATH=/opt/mysql-5.5.17-22.1
- -DCMAKE_INSTALL_PREFIX:PATH=/opt/mysql-5.5.17-22.1
- -DENABLED_PROFILING:BOOL=ON
- -DENABLE_DEBUG_SYNC:BOOL=OFF
- -DMYSQL_DATADIR:PATH=/opt/mysql-5.5.17-22.1/var
- -DMYSQL_MAINTAINER_MODE:BOOL=OFF
- -DWITH_EXTRA_CHARSETS=all
- -DWITH_BIG_TABLES:BOOL=ON
- -DWITH_FAST_MUTEXES:BOOL=ON
- -DENABLE-PROFILING:BOOL=ON
- -DWITH_SSL:STRING=bundled
- -DWITH_UNIT_TESTS:BOOL=OFF
- -DWITH_ZLIB:STRING=bundled
- -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON
- -DWITH_PLUGINS=heap,csv,partition,innodb_plugin,myisam
- -DEFAULT_COLLATION=utf8_general_ci
- -DEFAULT_CHARSET=utf8
- -DENABLED_ASSEMBLER:BOOL=ON
- -DENABLED_LOCAL_INFILE:BOOL=ON
- -DENABLED_THREAD_SAFE_CLIENT:BOOL=ON
- -DENABLED_EMBEDDED_SERVER:BOOL=OFF
- -DWITH_CLIENT_LDFLAGS:STRING=all-static
- -DINSTALL_LAYOUT:STRING=STANDALONE
- -DCOMMUNITY_BUILD:BOOL=ON;
失败后更改配制操作
- make clean
- rm -f CMakeCache.txt
编译安装
- make
- make install
- cp support-files/mysql.server /opt/mysql-5.5.17-22.1/bin/
- chown -R mysql:mysql /opt/mysql-5.5.17-22.1
- chmod 755 /opt/mysql-5.5.17-22.1/bin/mysql.server
- ln -s /opt/mysql-5.5.17-22.1/ /opt/mysql
复制5.1全部数据
- cp -a /opt/mysql-5.1.26rc/var /opt/mysql-5.5.17-22.1/
复制5.1的原配置文件启动出错
- cp /opt/mysql-5.1.26rc/my.cnf /opt/mysql-5.5.17-22.1/
- /opt/mysql-5.5.17-22.1/bin/mysqld –skip-grant-tables –user=mysql
- 111212 15:50:51 [Note] Flashcache bypass: disabled
- 111212 15:50:51 [Note] Flashcache setup error is : ioctl failed
- 111212 15:50:51 [Warning] option ‘innodb-autoextend-increment’: unsigned value 52428800 adjusted to 1000
- 111212 15:50:51 [Note] Plugin ‘InnoDB’ is disabled.
- 111212 15:50:51 [ERROR] bin/mysqld: unknown option ‘–skip-locking’
- 111212 15:50:51 [ERROR] Aborting
- 111212 15:50:51 [Note] bin/mysqld: Shutdown complete
mysql5.5不再支持skip-locking 参数,需从my.cnf中去除;
如果原先用了innodb还需修改参数和实际文件大小一致
- ls -lh /opt/mysql/var/
- -rw-r—– 1 mysql mysql 2030043136 Dec 13 16:55 ibdata1
- -rw-r—– 1 mysql mysql 67108864 Dec 13 16:55 ib_logfile0
- -rw-r—– 1 mysql mysql 67108864 Dec 13 16:37 ib_logfile1
计算ibdata1 文件大小 2030043136/1024/1024=1936M,ib_logfile=67108864/1024/1024=64M
- innodb_data_file_path = ibdata1:1936M:autoextend
- innodb_log_file_size = 64M
- innodb_log_files_in_group = 2
- #后面不需要M
- innodb-autoextend-increment=50
修改过的my.cnf
discuz论坛应用,innodb数据2G左右
- [client]
- port = 3306
- socket = /opt/mysql/mysql.sock
- [mysqld]
- port = 3306
- socket = /opt/mysql/mysql.sock
- #skip-locking
- skip-name-resolve
- back_log=100
- key_buffer_size = 4128M
- query_cache_size = 128M
- query_cache_limit = 2M #default=1M
- query_cache_min_res_unit = 2k #default=4K
- max_allowed_packet = 16M
- table_cache = 5096
- table_definition_cache = 1024
- tmp_table_size = 1792M #default=16M
- max_heap_table_size = 512M #default=16M
- read_buffer_size = 8M
- read_rnd_buffer_size = 32M
- sort_buffer_size = 256M
- join_buffer_size = 20M
- myisam_sort_buffer_size = 256M
- thread_cache_size = 80 #default=0
- thread_stack = 192K #default=192K
- thread_concurrency = 16 #default=10
- connect_timeout = 30
- max_connection = 500
- max_connect_errors = 30
- wait_timeout = 30
- concurrent_insert=2 #以增加碎片代价提高写入
- server-id = 9
- innodb_additional_mem_pool_size = 64M
- innodb_buffer_pool_size = 4G
- innodb_autoextend_increment =50
- #ibdata1以实际文件大小代替
- innodb_data_file_path = ibdata1:1936M:autoextend
- #新增参数
- innodb_write_io_threads = 8
- #新增参数
- innodb_read_io_threads = 8
- innodb_thread_concurrency = 16
- innodb_flush_log_at_trx_commit = 0
- innodb_log_buffer_size = 8M
- #log_file和原配置保持一样
- innodb_log_file_size = 64M
- innodb_log_files_in_group = 2
- innodb_max_dirty_pages_pct = 60
- innodb_lock_wait_timeout = 50
- #innodb_file_per_table
- [mysqldump]
- quick
- max_allowed_packet = 32M
- [mysql]
- no-auto-rehash
- [isamchk]
- key_buffer = 256M
- sort_buffer_size = 256M
- read_buffer = 8M
- write_buffer = 8M
- [myisamchk]
- key_buffer = 256M
- sort_buffer_size = 256M
- read_buffer = 8M
- write_buffer = 8M
- [mysqlhotcopy]
- interactive-timeout
再次跳过权限表启动
- /opt/mysql-5.5.17-22.1/bin/mysqld –skip-grant-tables –user=mysql
- 111213 16:49:29 [Note] Flashcache bypass: disabled
- 111213 16:49:29 [Note] Flashcache setup error is : ioctl failed
- 111213 16:49:29 InnoDB: The InnoDB memory heap is disabled
- 111213 16:49:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
- 111213 16:49:29 InnoDB: Compressed tables use zlib 1.2.3
- 111213 16:49:29 InnoDB: Initializing buffer pool, size = 4.0G
- 111213 16:49:30 InnoDB: Completed initialization of buffer pool
- 111213 16:49:30 InnoDB: highest supported file format is Barracuda.
- InnoDB: 127 rollback segment(s) active.
- 111213 16:49:30 InnoDB: Waiting for the background threads to start
- 111213 16:49:31 Percona XtraDB (http://www.percona.com) 1.1.8-20.1 started; log sequence number 1881683892
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'events_waits_current’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'events_waits_history’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'events_waits_history_long’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'setup_consumers’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'setup_instruments’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'setup_timers’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'performance_timers’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'threads’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'events_waits_summary_by_thread_by_event_name’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'events_waits_summary_by_instance’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'events_waits_summary_global_by_event_name’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'file_summary_by_event_name’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'file_summary_by_instance’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'mutex_instances’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'rwlock_instances’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'cond_instances’ has the wrong structure
- 111213 16:49:31 [ERROR] Native table ‘performance_schema’.'file_instances’ has the wrong structure
- 111213 16:49:31 [Note] /opt/mysql-5.5.17-22.1/bin/mysqld: ready for connections.
- Version: ’5.5.17′ socket: ‘/opt/mysql/mysql.sock’ port: 3306 Source distribution
升级
再重启下mysql就可以使用.
mysql5.1的myisam,innodb共享或单表都可以顺利升到5.5.
需注意字符编码,-skip-locking参数,innodb共享池及日志大小
[@more@]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23721637/viewspace-1057620/
,如需转载,请注明出处,否则将追究法律责任。