很快,很直接 ~ 最近在折腾线上的mysql的表分区分表,但是貌似5.5之前的版本不支持分区磁盘的制定,据朋友说 5.6 才支持。 好吧,速度yum一个mysql5.6 试试。
需要先导入一个repo的包。
yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
下面是再具体的步骤,很简单。。。。
[root@vm55 ~]# yum install mysql mysql-devel mysql-server mysql-utilities Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/metalink | 5.7 kB 00:00 * base: mirrors.btte.net * epel: ftp.sjtu.edu.cn * extras: mirrors.btte.net * updates: mirrors.btte.net epel | 4.4 kB 00:00 epel/primary_db | 6.3 MB 00:03 mysql-connectors-community | 2.5 kB 00:00 mysql-connectors-community/primary_db | 6.8 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql-tools-community/primary_db | 14 kB 00:00 mysql56-community | 2.5 kB 00:00 mysql56-community/primary_db | 49 kB 00:00 Setting up Install Process Package mysql is obsoleted by mysql-community-client, trying to install mysql-community-client-5.6.20-4.el6.x86_64 instead Package mysql-devel is obsoleted by mysql-community-devel, trying to install mysql-community-devel-5.6.20-4.el6.x86_64 instead Package mysql-server is obsoleted by mysql-community-server, trying to install mysql-community-server-5.6.20-4.el6.x86_64 instead Resolving Dependencies --> Running transaction check ---> Package mysql-community-client.x86_64 0:5.6.20-4.el6 will be installed --> Processing Dependency: mysql-community-libs(x86-64) = 5.6.20-4.el6 for package: mysql-community-client-5.6.20-4.el6.x86_64 ---> Package mysql-community-devel.x86_64 0:5.6.20-4.el6 will be installed ---> Package mysql-community-server.x86_64 0:5.6.20-4.el6 will be installed --> Processing Dependency: mysql-community-common(x86-64) = 5.6.20-4.el6 for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.6.20-4.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.4.4-1.el6 will be installed --> Processing Dependency: mysql-connector-python >= 1.2.1 for package: mysql-utilities-1.4.4-1.el6.noarch --> Running transaction check ---> Package libaio.x86_64 0:0.3.107-10.el6 will be installed ---> Package mysql-community-common.x86_64 0:5.6.20-4.el6 will be installed ---> Package mysql-community-libs.x86_64 0:5.6.20-4.el6 will be obsoleting ---> Package mysql-connector-python.noarch 0:1.2.3-1.el6 will be installed ---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64 --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64 ---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed --> Running transaction check ---> Package mysql-community-libs-compat.x86_64 0:5.6.20-4.el6 will be obsoleting ---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated ---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================================== Installing: mysql-community-client x86_64 5.6.20-4.el6 mysql56-community 18 M mysql-community-devel x86_64 5.6.20-4.el6 mysql56-community 3.2 M mysql-community-libs x86_64 5.6.20-4.el6 mysql56-community 1.9 M replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-libs-compat x86_64 5.6.20-4.el6 mysql56-community 1.6 M replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-server x86_64 5.6.20-4.el6 mysql56-community 52 M mysql-utilities noarch 1.4.4-1.el6 mysql-tools-community 952 k Installing for dependencies: libaio x86_64 0.3.107-10.el6 base 21 k mysql-community-common x86_64 5.6.20-4.el6 mysql56-community 299 k mysql-connector-python noarch 1.2.3-1.el6 mysql-connectors-community 191 k perl-DBI x86_64 1.609-4.el6 base 705 k Updating for dependencies: postfix x86_64 2:2.6.6-6.el6_5 updates 2.0 M Transaction Summary ================================================================================================================================================================================== Install 10 Package(s) Upgrade 1 Package(s) Total download size: 81 M Is this ok [y/N]: y Downloading Packages: (1/11): libaio-0.3.107-10.el6.x86_64.rpm | 21 kB 00:00 (2/11): mysql-community-client-5.6.20-4.el6.x86_64.rpm | 18 MB 00:49 (3/11): mysql-community-common-5.6.20-4.el6.x86_64.rpm | 299 kB 00:00 (4/11): mysql-community-devel-5.6.20-4.el6.x86_64.rpm | 3.2 MB 00:11 (5/11): mysql-community-libs-5.6.20-4.el6.x86_64.rpm | 1.9 MB 00:05 (6/11): mysql-community-libs-compat-5.6.20-4.el6.x86_64.rpm | 1.6 MB 00:07 (7/11): mysql-community-server-5.6.20-4.el6.x86_64.rpm (57%) 41% [========================= ] 328 kB/s | 22 MB 01:35 ETA (7/11): mysql-community-server-5.6.20-4.el6.x86_64.rpm | 52 MB 02:53 (8/11): mysql-connector-python-1.2.3-1.el6.noarch.rpm | 191 kB 00:00 (9/11): mysql-utilities-1.4.4-1.el6.noarch.rpm | 952 kB 00:03 (10/11): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:00 (11/11): postfix-2.6.6-6.el6_5.x86_64.rpm | 2.0 MB 00:01 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 324 kB/s | 81 MB 04:14 warning: rpmts_HdrFromFdno: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Importing GPG key 0x5072E1F5: Userid : MySQL Release Engineering <mysql-build@oss.oracle.com> Package: mysql-community-release-el6-5.noarch (@/mysql-community-release-el6-5.noarch) From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Is this ok [y/N]: Didn't install any keys [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# yum install mysql mysql-devel mysql-server mysql-utilities Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.btte.net * epel: ftp.sjtu.edu.cn * extras: mirrors.btte.net * updates: mirrors.btte.net Setting up Install Process Package mysql is obsoleted by mysql-community-client, trying to install mysql-community-client-5.6.20-4.el6.x86_64 instead Package mysql-devel is obsoleted by mysql-community-devel, trying to install mysql-community-devel-5.6.20-4.el6.x86_64 instead Package mysql-server is obsoleted by mysql-community-server, trying to install mysql-community-server-5.6.20-4.el6.x86_64 instead Resolving Dependencies --> Running transaction check ---> Package mysql-community-client.x86_64 0:5.6.20-4.el6 will be installed --> Processing Dependency: mysql-community-libs(x86-64) = 5.6.20-4.el6 for package: mysql-community-client-5.6.20-4.el6.x86_64 ---> Package mysql-community-devel.x86_64 0:5.6.20-4.el6 will be installed ---> Package mysql-community-server.x86_64 0:5.6.20-4.el6 will be installed --> Processing Dependency: mysql-community-common(x86-64) = 5.6.20-4.el6 for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.6.20-4.el6.x86_64 --> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.6.20-4.el6.x86_64 ---> Package mysql-utilities.noarch 0:1.4.4-1.el6 will be installed --> Processing Dependency: mysql-connector-python >= 1.2.1 for package: mysql-utilities-1.4.4-1.el6.noarch --> Running transaction check ---> Package libaio.x86_64 0:0.3.107-10.el6 will be installed ---> Package mysql-community-common.x86_64 0:5.6.20-4.el6 will be installed ---> Package mysql-community-libs.x86_64 0:5.6.20-4.el6 will be obsoleting ---> Package mysql-connector-python.noarch 0:1.2.3-1.el6 will be installed ---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64 --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64 ---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed --> Running transaction check ---> Package mysql-community-libs-compat.x86_64 0:5.6.20-4.el6 will be obsoleting ---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated ---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================================== Installing: mysql-community-client x86_64 5.6.20-4.el6 mysql56-community 18 M mysql-community-devel x86_64 5.6.20-4.el6 mysql56-community 3.2 M mysql-community-libs x86_64 5.6.20-4.el6 mysql56-community 1.9 M replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-libs-compat x86_64 5.6.20-4.el6 mysql56-community 1.6 M replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-server x86_64 5.6.20-4.el6 mysql56-community 52 M mysql-utilities noarch 1.4.4-1.el6 mysql-tools-community 952 k Installing for dependencies: libaio x86_64 0.3.107-10.el6 base 21 k mysql-community-common x86_64 5.6.20-4.el6 mysql56-community 299 k mysql-connector-python noarch 1.2.3-1.el6 mysql-connectors-community 191 k perl-DBI x86_64 1.609-4.el6 base 705 k Updating for dependencies: postfix x86_64 2:2.6.6-6.el6_5 updates 2.0 M Transaction Summary ================================================================================================================================================================================== Install 10 Package(s) Upgrade 1 Package(s) Total size: 81 M Is this ok [y/N]: y Downloading Packages: warning: rpmts_HdrFromFdno: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Importing GPG key 0x5072E1F5: Userid : MySQL Release Engineering <mysql-build@oss.oracle.com> Package: mysql-community-release-el6-5.noarch (@/mysql-community-release-el6-5.noarch) From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql-community-common-5.6.20-4.el6.x86_64 1/13 Installing : mysql-community-libs-5.6.20-4.el6.x86_64 2/13 Installing : mysql-community-libs-compat-5.6.20-4.el6.x86_64 3/13 Installing : mysql-community-client-5.6.20-4.el6.x86_64 4/13 Installing : libaio-0.3.107-10.el6.x86_64 5/13 Installing : perl-DBI-1.609-4.el6.x86_64 6/13 Installing : mysql-connector-python-1.2.3-1.el6.noarch 7/13 Installing : mysql-utilities-1.4.4-1.el6.noarch 8/13 Installing : mysql-community-server-5.6.20-4.el6.x86_64 9/13 Updating : 2:postfix-2.6.6-6.el6_5.x86_64 10/13 Installing : mysql-community-devel-5.6.20-4.el6.x86_64 11/13 Cleanup : 2:postfix-2.6.6-2.2.el6_1.x86_64 12/13 Erasing : mysql-libs-5.1.71-1.el6.x86_64 13/13 Verifying : mysql-community-libs-5.6.20-4.el6.x86_64 1/13 Verifying : mysql-community-libs-compat-5.6.20-4.el6.x86_64 2/13 Verifying : mysql-utilities-1.4.4-1.el6.noarch 3/13 Verifying : mysql-community-client-5.6.20-4.el6.x86_64 4/13 Verifying : mysql-community-devel-5.6.20-4.el6.x86_64 5/13 Verifying : mysql-connector-python-1.2.3-1.el6.noarch 6/13 Verifying : 2:postfix-2.6.6-6.el6_5.x86_64 7/13 Verifying : mysql-community-common-5.6.20-4.el6.x86_64 8/13 Verifying : perl-DBI-1.609-4.el6.x86_64 9/13 Verifying : mysql-community-server-5.6.20-4.el6.x86_64 10/13 Verifying : libaio-0.3.107-10.el6.x86_64 11/13 Verifying : 2:postfix-2.6.6-2.2.el6_1.x86_64 12/13 Verifying : mysql-libs-5.1.71-1.el6.x86_64 13/13 Installed: mysql-community-client.x86_64 0:5.6.20-4.el6 mysql-community-devel.x86_64 0:5.6.20-4.el6 mysql-community-libs.x86_64 0:5.6.20-4.el6 mysql-community-libs-compat.x86_64 0:5.6.20-4.el6 mysql-community-server.x86_64 0:5.6.20-4.el6 mysql-utilities.noarch 0:1.4.4-1.el6 Dependency Installed: libaio.x86_64 0:0.3.107-10.el6 mysql-community-common.x86_64 0:5.6.20-4.el6 mysql-connector-python.noarch 0:1.2.3-1.el6 perl-DBI.x86_64 0:1.609-4.el6 Dependency Updated: postfix.x86_64 2:2.6.6-6.el6_5 Replaced: mysql-libs.x86_64 0:5.1.71-1.el6 Complete! [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# /etc/init.d/mysqld start 初始化 MySQL 数据库: 2014-09-11 23:28:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-09-11 23:28:15 1576 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-09-11 23:28:15 1576 [Note] InnoDB: The InnoDB memory heap is disabled 2014-09-11 23:28:15 1576 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2014-09-11 23:28:15 1576 [Note] InnoDB: Memory barrier is not used 2014-09-11 23:28:15 1576 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-09-11 23:28:15 1576 [Note] InnoDB: Using Linux native AIO 2014-09-11 23:28:15 1576 [Note] InnoDB: Not using CPU crc32 instructions 2014-09-11 23:28:15 1576 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-09-11 23:28:15 1576 [Note] InnoDB: Completed initialization of buffer pool 2014-09-11 23:28:15 1576 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2014-09-11 23:28:15 1576 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2014-09-11 23:28:15 1576 [Note] InnoDB: Database physically writes the file full: wait... 2014-09-11 23:28:15 1576 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2014-09-11 23:28:16 1576 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2014-09-11 23:28:16 1576 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2014-09-11 23:28:16 1576 [Warning] InnoDB: New log files created, LSN=45781 2014-09-11 23:28:16 1576 [Note] InnoDB: Doublewrite buffer not found: creating new 2014-09-11 23:28:16 1576 [Note] InnoDB: Doublewrite buffer created 2014-09-11 23:28:16 1576 [Note] InnoDB: 128 rollback segment(s) are active. 2014-09-11 23:28:16 1576 [Warning] InnoDB: Creating foreign key constraint system tables. 2014-09-11 23:28:16 1576 [Note] InnoDB: Foreign key constraint system tables created 2014-09-11 23:28:16 1576 [Note] InnoDB: Creating tablespace and datafile system tables. 2014-09-11 23:28:16 1576 [Note] InnoDB: Tablespace and datafile system tables created. 2014-09-11 23:28:16 1576 [Note] InnoDB: Waiting for purge to start 2014-09-11 23:28:16 1576 [Note] InnoDB: 5.6.20 started; log sequence number 0 2014-09-11 23:28:16 1576 [Note] Binlog end 2014-09-11 23:28:16 1576 [Note] InnoDB: FTS optimize thread exiting. 2014-09-11 23:28:16 1576 [Note] InnoDB: Starting shutdown... 2014-09-11 23:28:18 1576 [Note] InnoDB: Shutdown completed; log sequence number 1625977 2014-09-11 23:28:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-09-11 23:28:18 1598 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-09-11 23:28:18 1598 [Note] InnoDB: The InnoDB memory heap is disabled 2014-09-11 23:28:18 1598 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2014-09-11 23:28:18 1598 [Note] InnoDB: Memory barrier is not used 2014-09-11 23:28:18 1598 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-09-11 23:28:18 1598 [Note] InnoDB: Using Linux native AIO 2014-09-11 23:28:18 1598 [Note] InnoDB: Not using CPU crc32 instructions 2014-09-11 23:28:18 1598 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-09-11 23:28:18 1598 [Note] InnoDB: Completed initialization of buffer pool 2014-09-11 23:28:18 1598 [Note] InnoDB: Highest supported file format is Barracuda. 2014-09-11 23:28:18 1598 [Note] InnoDB: 128 rollback segment(s) are active. 2014-09-11 23:28:18 1598 [Note] InnoDB: Waiting for purge to start 2014-09-11 23:28:18 1598 [Note] InnoDB: 5.6.20 started; log sequence number 1625977 2014-09-11 23:28:18 1598 [Note] Binlog end 2014-09-11 23:28:18 1598 [Note] InnoDB: FTS optimize thread exiting. 2014-09-11 23:28:18 1598 [Note] InnoDB: Starting shutdown... 2014-09-11 23:28:20 1598 [Note] InnoDB: Shutdown completed; log sequence number 1625987 PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h vm55.xiaorui.cc password 'new-password' Alternatively you can run: /usr/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. Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com Note: new default config file not created. Please make sure your config file is current WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server [确定] 正在启动 mysqld: [确定] [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# [root@vm55 ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.20 MySQL Community Server (GPL) Copyright (c) 2000, 2014, 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.
mysql表分区,实现起来很简单,就是为了提高有多个磁盘的时候,提高io的吞吐 。 但是貌似mysql5.5不能实现指定目录的方式。 所以才用的mysql5.6 。
ceshi | CREATE TABLE `ceshi` ( `id` int(11) NOT NULL AUTO_INCREMENT, `department` varchar(32) DEFAULT NULL, `dbname` varchar(64) DEFAULT NULL, `user` varchar(32) DEFAULT NULL, `note` varchar(128) DEFAULT NULL, `tosql` varchar(10000) DEFAULT NULL, `result` varchar(10000) DEFAULT NULL, `want_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=400390 DEFAULT CHARSET=utf8 /*!50100 PARTITION BY RANGE (id) (PARTITION p0 VALUES LESS THAN (50000) DATA DIRECTORY = '/var/rui0/data' ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (100000) DATA DIRECTORY = '/var/rui1/data' ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (300000) DATA DIRECTORY = '/var/rui2/data' ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (400000) DATA DIRECTORY = '/var/rui3/data' ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (1000000) DATA DIRECTORY = '/var/rui4/data' ENGINE = InnoDB) */ |
咱们再来看看在目录是啥情况。
[root@slave1 var]# ll /var|grep rui drwxr-xr-x 3 mysql mysql 4096 9月 12 14:32 rui0 drwxr-xr-x 3 mysql mysql 4096 9月 12 14:32 rui1 drwxr-xr-x 3 mysql mysql 4096 9月 12 14:32 rui2 drwxr-xr-x 3 mysql mysql 4096 9月 12 14:32 rui3 drwxr-xr-x 3 mysql mysql 4096 9月 12 16:46 rui4 [root@slave1 var]#
这就行了 ~