Mysql之Percona(1)最新版本5.6.10…

来源:互联网 发布:电影台词拼接软件 编辑:程序博客网 时间:2024/06/02 02:32

 

percona是mysql被收购后,研发团队核心成员独立成立的咨询公司开发的mysql另一个分支,继承了mysql开源特性以及最大限度的支持mysql,并且提供了许多新的特性,使得该软件成为行业内最为流行的其中一个版本之一,本文以整理了各种安装中最为简洁的rpm包的
安装方式,以起到抛砖引玉之功效:

安装环境:
         操作系统:本安装过程在虚拟机中linux5.4版本安装完成,
         数据库:  percona5.6.10

 

安装思路步骤:

1.依次序安装三个文件
(先后顺序为shared/client/server,次序不能颠倒,否则不能正常安装)
 rpm -ivhPercona-Server-shared-56-5.6.10-alpha60.2.324.rhel5.i686.rpm
 rpm -ivhPercona-Server-client-56-5.6.10-alpha60.2.324.rhel5.i686.rpm
 rpm -ivhPercona-Server-server-56-5.6.10-alpha60.2.324.rhel5.i686.rpm
2.配置参数文件

  cp my-default.cnf /etc/my.cnf
  cp mysql.server /etc/init.d/mysql(部分版本必须要拷贝,本版本经测试不需拷贝)
  编辑my-default.cnf 配置文件,将其拷贝到对应位置/etc/my.cnf
  在my-default.cnf 文件中[mysqld]之下需要加添的是:
  explicit_defaults_for_timestamp=true
 在步骤一中有提示需要条件该参数,否则,数据库无法正常启动,这是通常安装数据库最长遇到的问题
  其他的几个内存配置参数#去掉保持最小配置即可,保存退出即可
  innodb_buffer_pool_size = 128M
  join_buffer_size = 128M
  sort_buffer_size = 2M
  read_rnd_buffer_size =2M  
 
 
3.运行mysql服务
  运行natstat -nat查看3306端口是否使用
  service mysql start

4.测试数据库是否正常
  mysql -u root

5.常见错误处理


以下为具体的安装步骤为(没有任何遗漏):

步骤一:安装三个文件
(当然需要上传三个文件,本例上传到/usr/local目录下)
有以下提示信息,暂不用理会,稍后处理
[root@localhost ~]# cd /usr/local
[root@localhost local]# ls
bin   include Percona-Server-client-56-5.6.10-alpha60.2.324.rhel5.i686.rpm sbin
etc   lib     Percona-Server-server-56-5.6.10-alpha60.2.324.rhel5.i686.rpm share
games  libexec Percona-Server-shared-56-5.6.10-alpha60.2.324.rhel5.i686.rpm src
[root@localhost local]# ls
bin   include Percona-Server-client-56-5.6.10-alpha60.2.324.rhel5.i686.rpm sbin
etc   lib     Percona-Server-server-56-5.6.10-alpha60.2.324.rhel5.i686.rpm share
games  libexec Percona-Server-shared-56-5.6.10-alpha60.2.324.rhel5.i686.rpm src
[root@localhost local]# rpm -ivhPercona-Server-shared-56-5.6.10-alpha60.2.324.rhel5.i686.rpm
warning:Percona-Server-shared-56-5.6.10-alpha60.2.324.rhel5.i686.rpm:Header V4 DSA signature: NOKEY, key ID cd2efd2a
Preparing...               ########################################### [100%]
  1:Percona-Server-shared-5###########################################[100%]
[root@localhost local]# rpm -ivhPercona-Server-client-56-5.6.10-alpha60.2.324.rhel5.i686.rpm
warning:Percona-Server-client-56-5.6.10-alpha60.2.324.rhel5.i686.rpm:Header V4 DSA signature: NOKEY, key ID cd2efd2a
Preparing...               ########################################### [100%]
  1:Percona-Server-client-5###########################################[100%]
[root@localhost local]# rpm -ivhPercona-Server-server-56-5.6.10-alpha60.2.324.rhel5.i686.rpm
warning:Percona-Server-server-56-5.6.10-alpha60.2.324.rhel5.i686.rpm:Header V4 DSA signature: NOKEY, key ID cd2efd2a
Preparing...               ########################################### [100%]
  1:Percona-Server-server-5###########################################[100%]
2013-05-30 13:11:06 0 [Warning] TIMESTAMP with implicit DEFAULTvalue is deprecated. Please use --explicit_defaults_for_timestampserver option (see documentation for more details).
2013-05-30 13:11:06 14120 [Note] InnoDB: The InnoDB memory heap isdisabled
2013-05-30 13:11:06 14120 [Note] InnoDB: Mutexes and rw_locks useGCC atomic builtins
2013-05-30 13:11:06 14120 [Note] InnoDB: Compressed tables use zlib1.2.3
2013-05-30 13:11:06 14120 [Note] InnoDB: CPU does not support crc32instructions
2013-05-30 13:11:06 14120 [Note] InnoDB: Using Linux nativeAIO
2013-05-30 13:11:06 14120 [Note] InnoDB: Initializing buffer pool,size = 128.0M
2013-05-30 13:11:06 14120 [Note] InnoDB: Completed initializationof buffer pool
2013-05-30 13:11:06 14120 [Note] InnoDB: The first specified datafile ./ibdata1 did not exist: a new database to be created!
2013-05-30 13:11:06 14120 [Note] InnoDB: Setting file ./ibdata1size to 12 MB
2013-05-30 13:11:06 14120 [Note] InnoDB: Database physically writesthe file full: wait...
2013-05-30 13:11:07 14120 [Note] InnoDB: Setting log file./ib_logfile101 size to 48 MB
2013-05-30 13:11:08 14120 [Note] InnoDB: Setting log file./ib_logfile1 size to 48 MB
2013-05-30 13:11:09 14120 [Note] InnoDB: Renaming log file./ib_logfile101 to ./ib_logfile0
2013-05-30 13:11:09 14120 [Warning] InnoDB: New log files created,LSN=45781
2013-05-30 13:11:09 14120 [Note] InnoDB: Doublewrite buffer notfound: creating new
2013-05-30 13:11:10 14120 [Note] InnoDB: Doublewrite buffercreated
2013-05-30 13:11:10 14120 [Note] InnoDB: 128 rollback segment(s)are active.
2013-05-30 13:11:10 14120 [Warning] InnoDB: Creating foreign keyconstraint system tables.
2013-05-30 13:11:10 14120 [Note] InnoDB: Foreign key constraintsystem tables created
2013-05-30 13:11:10 14120 [Note] InnoDB: Creating tablespace anddatafile system tables.
2013-05-30 13:11:10 14120 [Note] InnoDB: Tablespace and datafilesystem tables created.
2013-05-30 13:11:10 14120 [Note] InnoDB: Waiting for purge tostart
2013-05-30 13:11:10 14120 [Note] InnoDB: 1.2.10 started; logsequence number 0
2013-05-30 13:11:11 14120 [Note] Binlog end
2013-05-30 13:11:11 14120 [Note] InnoDB: FTS optimize threadexiting.
2013-05-30 13:11:11 14120 [Note] InnoDB: Starting shutdown...
2013-05-30 13:11:12 14120 [Note] InnoDB: Shutdown completed; logsequence number 1625977

2013-05-30 13:11:12 0 [Warning] TIMESTAMP with implicit DEFAULTvalue is deprecated. Please use --explicit_defaults_for_timestampserver option (see documentation for more details).
2013-05-30 13:11:12 14143 [Note] InnoDB: The InnoDB memory heap isdisabled
2013-05-30 13:11:12 14143 [Note] InnoDB: Mutexes and rw_locks useGCC atomic builtins
2013-05-30 13:11:12 14143 [Note] InnoDB: Compressed tables use zlib1.2.3
2013-05-30 13:11:12 14143 [Note] InnoDB: CPU does not support crc32instructions
2013-05-30 13:11:12 14143 [Note] InnoDB: Using Linux nativeAIO
2013-05-30 13:11:12 14143 [Note] InnoDB: Initializing buffer pool,size = 128.0M
2013-05-30 13:11:12 14143 [Note] InnoDB: Completed initializationof buffer pool
2013-05-30 13:11:12 14143 [Note] InnoDB: Highest supported fileformat is Barracuda.
2013-05-30 13:11:13 14143 [Note] InnoDB: 128 rollback segment(s)are active.
2013-05-30 13:11:13 14143 [Note] InnoDB: Waiting for purge tostart
2013-05-30 13:11:13 14143 [Note] InnoDB: 1.2.10 started; logsequence number 1625977
2013-05-30 13:11:13 14143 [Note] Binlog end
2013-05-30 13:11:13 14143 [Note] InnoDB: FTS optimize threadexiting.
2013-05-30 13:11:13 14143 [Note] InnoDB: Starting shutdown...
2013-05-30 13:11:15 14143 [Note] InnoDB: Shutdown completed; logsequence 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 -hlocalhost.localdomain 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 with the /usr/bin/mysqlbugscript!

The latest information about MySQL is available on the webat

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

Percona Server is distributed with several useful UDF (UserDefined Function) from Maatkit.
Run the following commands to create these functions:
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME'libmurmur_udf.so'"
See http://code.google.com/p/maatkit/source/browse/trunk/udffor more details
[root@localhost local]#

步骤二:配置参数文件
[root@localhost ~]# whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql/usr/share/man/man1/mysql.1.gz
[root@localhost ~]# cd /usr/share/mysql/
[root@localhost mysql]# ls
binary-configure english              hungarian                   mysqld_multi.server          norwegian    serbian
bulgarian        errmsg-utf8.txt      innodb_memcached_config.sql mysql-log-rotate             norwegian-ny  slovak
charsets         estonian             italian                     mysql_security_commands.sql  polish       solaris
czech            fill_help_tables.sql japanese                    mysql.server                 portuguese   spanish
danish           french               korean                      mysql_system_tables_data.sql romanian     swedish
dictionary.txt   german               magic                       mysql_system_tables.sql      russian      ukrainian
dutch            greek                my-default.cnf              mysql_test_data_timezone.sql  SELinux
[root@localhost mysql]# vi my-default.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copiedto the
# *** default location during install, and will be replaced ifyou
# *** upgrade to a newer version of MySQL.

[mysqld]
explicit_defaults_for_timestamp=true
# Remove leading # and set to the amount of RAM for the mostimportant data
# cache in MySQL. Start at 70% of total RAM for dedicated server,else 10%.
 innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrityoption: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set asrequired.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reportingservers.
# The server defaults are faster for transactions and fastSELECTs.
# Adjust sizes as needed, experiment to find the optimalvalues.
 join_buffer_size = 128M
 sort_buffer_size = 2M
 read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
~
~
~
~
~
~
~
~
~
~
~
~
"my-default.cnf" 31L, 1158C written
[root@localhost mysql]# ls
binary-configure english              hungarian                   mysqld_multi.server          norwegian    serbian
bulgarian        errmsg-utf8.txt      innodb_memcached_config.sql mysql-log-rotate             norwegian-ny  slovak
charsets         estonian             italian                     mysql_security_commands.sql  polish       solaris
czech            fill_help_tables.sql japanese                    mysql.server                 portuguese   spanish
danish           french               korean                      mysql_system_tables_data.sql romanian     swedish
dictionary.txt   german               magic                       mysql_system_tables.sql      russian      ukrainian
dutch            greek                my-default.cnf              mysql_test_data_timezone.sql  SELinux
[root@localhost mysql]# cp my-default.cnf /etc/my.cnf
[root@localhost mysql]# cp mysql.server /etc/init.d/mysql
cp: overwrite `/etc/init.d/mysql'?

步骤三:查看服务端口是否起来,启动数据库
[root@localhost ~]# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q LocalAddress              ForeignAddress            State     
tcp           0127.0.0.1:2208             0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:868                0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:11111              0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:111                0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:16851              0.0.0.0:*                  LISTEN     
tcp           0192.168.122.1:53           0.0.0.0:*                  LISTEN     
tcp           0127.0.0.1:631              0.0.0.0:*                  LISTEN     
tcp           0127.0.0.1:25               0.0.0.0:*                  LISTEN     
tcp           0127.0.0.1:2207             0.0.0.0:*                  LISTEN     
tcp           0:::22                      :::*                       LISTEN     
tcp           0::ffff:192.168.66.111:22   ::ffff:192.168.66.101:1953  ESTABLISHED
tcp           0::ffff:192.168.66.111:22   ::ffff:192.168.66.101:1973  ESTABLISHED
[root@localhost ~]#

[root@localhost mysql]# service mysql start
Starting MySQL....[  OK  ]
[root@localhost mysql]#
[root@localhost ~]# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q LocalAddress              ForeignAddress            State     
tcp           0127.0.0.1:2208             0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:868                0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:11111              0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:111                0.0.0.0:*                  LISTEN     
tcp           00.0.0.0:16851              0.0.0.0:*                  LISTEN     
tcp           0192.168.122.1:53           0.0.0.0:*                  LISTEN     
tcp           0127.0.0.1:631              0.0.0.0:*                  LISTEN     
tcp           0127.0.0.1:25               0.0.0.0:*                  LISTEN     
tcp           0127.0.0.1:2207             0.0.0.0:*                  LISTEN     
tcp           0:::3306                    :::*                       LISTEN     
tcp           0:::22                      :::*                       LISTEN     
tcp           0::ffff:192.168.66.111:22   ::ffff:192.168.66.101:1953  ESTABLISHED
tcp           0::ffff:192.168.66.111:22   ::ffff:192.168.66.101:1973  ESTABLISHED
[root@localhost ~]#

步骤四:连接数据库测试
[root@localhost ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ;or \g.
Your MySQL connection id is 1
Server version: 5.6.10-56 Percona Server (GPL), Release alpha60.2,Revision 324

Copyright (c) 2000, 2013, Oracle and/or its affiliates. Allrights reserved.

Oracle is a registered trademark of Oracle Corporation and/orits
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the currentinput statement.


mysql> show databases;
+--------------------+
|Database          |
+--------------------+
| information_schema |
|mysql             |
| performance_schema |
|test              |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql
Reading table information for completion of table and columnnames
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>  create table ljg (namevarchar(10),old numeric(8));
Query OK, 0 rows affected (0.06 sec)

mysql> insert into ljgvalues('liujianguo',35);
Query OK, 1 row affected (0.01 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from ljg;
+------------+------+
|name      | old  |
+------------+------+
| liujianguo |   35 |
+------------+------+
1 row in set (0.00 sec)

mysql>

以上为percona最新版本5.6.10基本的安装过程,给第一次接触percona的同学提供一个完全的一步不漏的最新版本的安装过程,供学习参考。

 

5.常见错误处理

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (seedocumentation for more details).

提示要在配置文件中添加explicit_defaults_for_timestamp=true即可。
具体是:
vi /etc/my.cnf
中的[mysqld]下添加explicit_defaults_for_timestamp=true即可

 

========================================================================================

==本博所有内容均由数据库男本人实际工作环境或模拟操作过程,如有编辑错误或其他问题请和本==

==人留言或联系。发扬互联网精神,一起学习,共同努力,完成由专注到卓越的飞跃。?!?    ==

==QQ:77113981                                                !! =============   ==

========================================================================================


 

0 0