安裝環境:
CentOS 5.8/6.4 x84_64
MySQL-5.6.15
一.MySQL5.6版本新特性介紹
MySQL 在 5.6 版本中顯著提高了它的性能和可用性、集成度、查詢性能,可支持下一代 Web、嵌入式和雲計算應用程序。
它具備有以下特性:
具備以下特性:
· 新增! 在線 DDL /更改數據架構支持動態應用程序和開發人員靈活性;
· 新增! 複製全局事務標識可支持自我修復式集羣;
· 新增! 複製無崩潰從機可提高可用性;
· 新增! 複製多線程從機可提高性能;
· 新增! 對 InnoDB 進行 NoSQL 訪問,可快速完成鍵值操作以及快速提取數據來完成大數據部署;
· 改進! 在 Linux 上的性能提升多達 230%;
· 改進! 在當今、多核、多 CPU 硬件上具備更高的擴展力;
· 改進! InnoDB 性能改進,可更加高效地處理事務和只讀負載;
· 改進! 更快速地執行查詢,增強的診斷功能;
· 改進! Performance Schema 可監視各個用戶/應用程序的資源佔用情況;
· 改進! 通過基於策略的密碼管理和實施來確保安全性;
· 高度可靠,幾乎無需干預即可確保系統持續不間斷運行;
· 簡便易用,只需 3 分鐘即可完成從下載到開發環境的安裝和配置過程;
· 管理需求低,數據庫維護工作非常少;
· 複製功能支持靈活的拓撲架構,可實現向外擴展和高可用性;
· 分區 有助於提高性能和管理超大型數據庫環境;
· ACID 事務支持構建安全可靠的關鍵業務應用程序;
· 存儲過程可提高開發人員效率;
· 觸發器可在數據庫層面實施複雜的業務規則;
· View 可確保敏感信息不受***;
· Information Schema 有助於方便地訪問元數據;
· 插入式存儲引擎架構可最大限度發揮靈活性;
PS:以上內容部分來自於網絡
5.6 幾個重要的特性---面試有可能問到哦...
1、CPU支持到64核心
2、可以在線DDL操作
3、基於庫的多線程複製,同時在開啓GTID時,slave在做同步複製時,無須找到binlog日誌和POS點
4、支持基於庫的多線程複製
5、支持InnoDB buffer pool 自動預熱功能(默認是關閉)
在關閉MYSQL的時候,把內存的數據保存在磁盤裏,開機時再加載!
6、InnoDB開始支持全文索引
7、優化了相關查詢操作,特別對子查詢性能進行了優化,如Index Condition Pushdown (ICP)是MySQL用索引去表裏取數據的一種優化
8、直接內部支持Memcached Nosql API
9、默認啓用performance_schema 數據庫,功能更加強大!
......
n、InnoDB功能的加強優化等,如InnoDB重寫日誌文件容量也增至2TB,能夠提升寫密集型應用程序的負載性能;
等等..............................
.......
二、MySQL5.6的安裝與配置
2.1 安裝依賴的庫
yum -y install gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel bison patch unzip libmcrypt-devel libmhash-devel ncurses-devel sudo bzip2 flex libaio-devel
2.2 安裝MySQL
2.2.1 安裝cmake 編譯器
cd /home/zjqiu tar zxf cmake-2.8.4.tar.gz cd cmake-2.8.4 ./bootstrap make && make install
2.2.2 MySQL數據庫安裝
useradd mysql -s /sbin/nologin -M cd .. tar zxf mysql-5.6.15.tar.gz cd mysql-5.6.15 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.6.15/ \ -DMYSQL_UNIX_ADDR=/data/mysql-3306/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DWITH_INNODB_MEMCACHED=1 \ -DWITH_DEBUG=OFF \ -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 \ -DENABLED_PROFILING=ON \ -DMYSQL_MAINTAINER_MODE=OFF \ -DMYSQL_DATADIR=/data/mysql-3306/data \ -DMYSQL_TCP_PORT=3306
PS:編譯參數沒啥好說的,不懂可以去看手冊哦~~~
make && make install ln -sv /usr/local/mysql5.6.15 /usr/local/mysql
2.2.3 創建my-3306.cnf配置文件
cat >> /etc/my.cnf << EOF [client] port = 3306 socket = /data/mysql-3306/mysql.sock [mysql] no-auto-rehash prompt="(\\u:opdba:\D)[\\d]> " #pager="less -i -n -S" #tee="/home/mysql/query.log" [mysqld] #Misc user = mysql port = 3306 socket = /data/mysql-3306/mysql.sock basedir = /usr/local/mysql datadir = /data/mysql-3306/data/ ft_min_word_len=1 #event_scheduler = 1 max_allowed_packet = 32M #default_table_type = innodb #default_table_engine = innodb #Performance net_read_timeout = 60 wait_timeout = 100 interactive_timeout = 100 open_files_limit = 10240 back_log = 150 max_connections = 1000 max_connect_errors = 100000 external-locking = FALSE performance_schema = 0 #buffers & cache table_open_cache = 2048 #在mysql5.6不再支持table_cache table_definition_cache = 2048 max_heap_table_size = 246M tmp_table_size = 246M sort_buffer_size = 2M join_buffer_size = 2M thread_cache_size = 256 #thread_concurrency = 8 query_cache_size = 32M query_cache_limit = 2M query_cache_min_res_unit = 2k thread_stack = 192K read_buffer_size = 1M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M #logs #log-output=file log-error=/data/mysql-3306/logs/mysql.err log_warnings = 2 slow-query-log slow-query-log-file=/data/mysql-3306/logs/slow-log.log long_query_time = 2 log-queries-not-using-indexes = 1 log-slow-admin-statements = 1 log-slow-slave-statements = 1 #binlog & replication server-id = 1 binlog_format = ROW binlog-row-image = minimal #binlog_format = MIXED log-bin = /data/mysql-3306/binlog/mysql-bin binlog_cache_size = 4M max_binlog_cache_size = 2G max_binlog_size = 1G expire_logs_days = 7 relay-log-purge = 1 sync_binlog = 0 skip-slave-start = 1 log-slave-updates = 1 #Myisam engine key_buffer_size = 32M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G #myisam_max_extra_sort_file_size = 10G myisam_repair_threads = 1 myisam_recover lower_case_table_names = 1 skip-name-resolve slave-skip-errors = 1032,1062 #Innodb engine innodb_additional_mem_pool_size = 16M innodb_buffer_pool_size = 20G innodb_data_file_path = ibdata1:1G:autoextend innodb_file_per_table = 1 innodb_thread_concurrency = 0 #innodb_thread_concurrency = 20 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 16M innodb_log_file_size = 256M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 75 innodb_lock_wait_timeout = 120 innodb_rollback_on_timeout innodb_status_file = 1 innodb_io_capacity = 800 transaction_isolation = READ-COMMITTED #transaction_isolation = repeatabled-read innodb_flush_method = O_DIRECT innodb-support-xa = 0 innodb_read_io_threads = 8 innodb_write_io_threads = 8 innodb_file_format = Barracuda # Other Set #gtid_mode = ON #enforce-gtid-consistency = true #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqldump] quick max_allowed_packet = 32M [mysqld_safe] pid-file=/data/mysql-3306/mysqld.pid EOF
PS:配置不懂的仁兄弟或美女也請去看官方文檔~~~
2.2.4 初使化數據庫
mkdir -p /data/mysql-3306/{binlog,logs,data} chown -R mysql.mysql /data/mysql-3306 cd /usr/local/mysql ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5.6.15 --datadir=/data/mysql-3306/data/ --explicit_defaults_for_timestamp
如果出現如下信息說明初使化成功:
Installing MySQL system tables...OK
Filling help tables...OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
//usr/local/mysql5.6.15/bin/mysqladmin -u root password 'new-password'
//usr/local/mysql5.6.15/bin/mysqladmin -u root -h MySQL56 password 'new-password'
Alternatively you can run:
//usr/local/mysql5.6.15/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; //usr/local/mysql5.6.15/bin/mysqld_safe &
......
.....
2.2.5 創建開機啓動腳本
cd /usr/local/mysql cp support-files/mysql.server /etc/rc.d/init.d/mysqld chkconfig --add mysqld chkconfig --level 35 mysqld on echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile source /etc/profile
2.2.6 啓動MySQL服務器
[root@MySQL56 mysql]# service mysqld start
Starting MySQL. [ OK ]
[root@MySQL56 mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.15-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
(root:opdba:Wed May 15 17:39:48 2013)[(none)]>
這部分只介紹了MySQL5.6一些新特性和安裝配置~~.......
參考: