Percona-mysql server 5.5升级5.6

http://blog.csdn.net/lqx0405/article/details/50162557

系统环境:

     操作系统:CentOS_6.5(64)      

     MySQL:   Percona server 5.5(5.6)

 

一、升级的目的

为什么MySQL升级是必须的? 原因有很多,比如:为了使用新增的特性,基于性能方面的考量, 修复的bug. 但是在没有充分的测试以前就应用到你的应用中是非常危险的, 因为升级可以能会让你的应用不能正常运作- 也可能引起性能的问题. 此外, 我建议你关注MySQL的发布信息和Percona Server - 看看最近的版本有什么变化. 也许在在最新的版本中已修复了某个你正在烦恼的问题.

二、升级的方式

通常情况下,有两中升级方式:

  • 直接升级:安装好新版本数据库后,利用已经存在的数据文件夹,同时运行mysql_upgrade脚本来升级。
  • SQL 导出: 从一个较老版本的mysql把数据导出,然后恢复到新版本的数据库中。(利用mysqldump工具)。

相比之下,第二种方式更安全些,但是这也会使得升级的过程要慢一些。

理论上讲,最安全的方式是:

  • 导出所有用户的权限
  • 导出所有数据并恢复到新版本数据库中
  • 恢复用户权限到新数据库中

三、升级的步骤

 

1、安装percona server 5.5

[[email protected] percona-55]# uname -a
Linux cent65 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# cd /home/mysql/percona-55/
[[email protected] percona-55]# ls

[sql] view plain copy

print?

  1. Percona-Server-55-debuginfo-5.5.46-rel37.5.el6.x86_64.rpm
  2. Percona-Server-client-55-5.5.46-rel37.5.el6.x86_64.rpm
  3. Percona-Server-devel-55-5.5.46-rel37.5.el6.x86_64.rpm
  4. Percona-Server-server-55-5.5.46-rel37.5.el6.x86_64.rpm
  5. Percona-Server-shared-55-5.5.46-rel37.5.el6.x86_64.rpm
  6. Percona-Server-test-55-5.5.46-rel37.5.el6.x86_64.rpm

安装percona server与系统自带的mysql冲突,首先卸载系统自带mysql:

[[email protected] percona-55]# rpm -ivh *
warning: Percona-Server-55-debuginfo-5.5.46-rel37.5.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
error: Failed dependencies:
        MySQL conflicts with mysql-5.1.71-1.el6.x86_64
        MySQL-server conflicts with mysql-server-5.1.71-1.el6.x86_64

卸载mysql:
[[email protected] percona-55]# rpm -e mysql-server --nodeps
[[email protected] percona-55]# rpm -e mysql --nodeps
[[email protected] percona-55]# rpm -e mysql-devel --nodeps

安装percona server:

[[email protected] percona-55]# rpm -ivh *
warning: Percona-Server-55-debuginfo-5.5.46-rel37.5.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:Percona-Server-shared-5########################################### [ 17%]
   2:Percona-Server-client-5########################################### [ 33%]
   3:Percona-Server-server-5########################################### [ 50%]

[sql] view plain copy

print?

  1. 151203 10:57:15 [Note] /usr/sbin/mysqld (mysqld 5.5.46-37.5) starting as process 2537 ...
  2. 151203 10:57:27 [Note] /usr/sbin/mysqld (mysqld 5.5.46-37.5) starting as process 2546 ...
  3. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  4. To do so, start the server, then issue the following commands:
  5. /usr/bin/mysqladmin -u root password ‘new-password‘
  6. /usr/bin/mysqladmin -u root -h cent65 password ‘new-password‘
  7. Alternatively you can run:
  8. /usr/bin/mysql_secure_installation
  9. which will also give you the option of removing the test
  10. databases and anonymous user created by default.  This is
  11. strongly recommended for production servers.
  12. See the manual for more instructions.
  13. Please report any problems at
  14. https://bugs.launchpad.net/percona-server/+filebug
  15. Percona recommends that all production deployments be protected with a support
  16. contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,
  17. be eligible for hot fixes, and boost your team‘s productivity.
  18. Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
  19. Run the following commands to create these functions:
  20. mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME ‘libfnv1a_udf.so‘"
  21. mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME ‘libfnv_udf.so‘"
  22. mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME ‘libmurmur_udf.so‘"
  23. See http://www.percona.com/doc/percona-server/5.5/management/udf_percona_toolkit.html for more details
  24. 4:Percona-Server-test-55 ########################################### [ 67%]
  25. 5:Percona-Server-devel-55########################################### [ 83%]
  26. 6:Percona-Server-55-debug########################################### [100%]

----安装成功 !

2、启动mysql server
[[email protected] percona-55]# service mysql start

Starting MySQL (Percona Server)....[  OK  ]
[[email protected] percona-55]# netstat -an |grep :3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN 
修改用户口令:
[[email protected] percona-55]# mysqladmin -u root password "oracle"

mysqladmin: connect to server at ‘localhost‘ failed
error: ‘Access denied for user ‘root‘@‘localhost‘ (using password: NO)‘

连接mysql server:
[[email protected] percona-55]# mysql -u root -p

Enter password:

[sql] view plain copy

print?

  1. Welcome to the MySQL monitor.  Commands end with ; or \g.
  2. Your MySQL connection id is 6
  3. Server version: 5.5.46-37.5 Percona Server (GPL), Release 37.5, Revision 684ce54
  4. Copyright (c) 2009-2015 Percona LLC and/or its affiliates
  5. Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  6. Oracle is a registered trademark of Oracle Corporation and/or its
  7. affiliates. Other names may be trademarks of their respective
  8. owners.
  9. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
创建测试库和表:
mysql> create database prod;

Query OK, 1 row affected (0.00 sec)
mysql> use prod;
Database changed
mysql> create table emp (id int ,name varchar(10));
Query OK, 0 rows affected (0.35 sec)
mysql> insert into emp values (10,‘tom‘);
Query OK, 1 row affected (0.11 sec)
mysql> insert into emp values (20,‘jerry‘);
Query OK, 1 row affected (0.17 sec)
mysql> insert into emp values (30,‘rose‘);
Query OK, 1 row affected (0.05 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)

查看表属性:
mysql> show create table emp\G

*************************** 1. row ***************************
       Table: emp
Create Table: CREATE TABLE `emp` (
  `id` int(11) DEFAULT NULL,
  `name` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> select * from emp;
+------+-------+
| id   | name  |
+------+-------+
|   10 | tom   |
|   20 | jerry |
|   30 | rose  |
+------+-------+
3 rows in set (0.00 sec)

二、准备升级percona server5.5到5.6

安装percona toolkit工具:

首先通过yum(本地库)安装perl软件:

[[email protected] yum.repos.d]# yum install -y perl-IO-Socket-SSL* --enablerepo=c6-media

[[email protected] yum.repos.d]# yum install -y perl-TermReadKey*  --enablerepo=c6-media

[[email protected] mysql]# rpm -ivh percona-toolkit-2.2.10-1.noarch.rpm
warning: percona-toolkit-2.2.10-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:percona-toolkit        ########################################### [100%]

1) 获取用户和权限信息. 该操作会备份所有用户的权限

[[email protected] mysql]# pt-show-grants --user=root --ask-pass --flush >/home/mysql/grants.sql
Enter password: 
查看sql scripts:
[[email protected] mysql]# cat grants.sql 

-

[sql] view plain copy

print?

  1. - Grants dumped by pt-show-grants
  2. -- Dumped from server Localhost via UNIX socket, MySQL 5.5.46-37.5 at 2015-12-03 12:22:00
  3. -- Grants for ‘‘@‘cent65‘
  4. GRANT ALTER, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, LOCK TABLES, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE ON `test\_%`.* TO ‘‘@‘%‘;
  5. GRANT ALTER, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, LOCK TABLES, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE ON `test`.* TO ‘‘@‘%‘;
  6. GRANT USAGE ON *.* TO ‘‘@‘cent65‘;
  7. -- Grants for ‘‘@‘localhost‘
  8. GRANT ALTER, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, LOCK TABLES, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE ON `test\_%`.* TO ‘‘@‘%‘;
  9. GRANT ALTER, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, LOCK TABLES, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE ON `test`.* TO ‘‘@‘%‘;
  10. GRANT USAGE ON *.* TO ‘‘@‘localhost‘;
  11. -- Grants for ‘root‘@‘127.0.0.1‘
  12. GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘127.0.0.1‘ WITH GRANT OPTION;
  13. -- Grants for ‘root‘@‘::1‘
  14. GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘::1‘ WITH GRANT OPTION;
  15. -- Grants for ‘root‘@‘cent65‘
  16. GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘cent65‘ WITH GRANT OPTION;
  17. GRANT PROXY ON ‘‘@‘‘ TO ‘root‘@‘cent65‘ WITH GRANT OPTION;
  18. -- Grants for ‘root‘@‘localhost‘
  19. GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ IDENTIFIED BY PASSWORD ‘*2447D497B9A6A15F2776055CB2D1E9F86758182F‘ WITH GRANT OPTION;
  20. GRANT PROXY ON ‘‘@‘‘ TO ‘root‘@‘localhost‘ WITH GRANT OPTION;
  21. FLUSH PRIVILEGES;

2)、dump 5.5数据库实例的所有信息(除去mysql, information_schema 和performance_schema数据库)

[[email protected] mysql]# mysql -uroot -p -BNe "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN (‘mysql‘, ‘performance_schema‘, ‘information_schema‘)" | tr ‘n‘ ‘ ‘ > /home/mysql/dbs-to-dump.sql
Enter password:

查看sql scripts:
[[email protected] mysql]# cat dbs-to-dump.sql 

prod
test
[[email protected] mysql]# mysqldump -u root -p --routines --events --single-transaction --databases $(cat /home/mysql/dbs-to-dump.sql) > /home/mysql/full-data-dump.sql
Enter password: 
[[email protected] mysql]# cat full-data-dump.sql 

[sql] view plain copy

print?

  1. -- MySQL dump 10.13  Distrib 5.5.46-37.5, for Linux (x86_64)
  2. --
  3. -- Host: localhost    Database: prod
  4. -- ------------------------------------------------------
  5. -- Server version       5.5.46-37.5
  6. /*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
  7. /*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
  8. /*!40101 SET @[email protected]@COLLATION_CONNECTION */;
  9. /*!40101 SET NAMES utf8 */;
  10. /*!40103 SET @[email protected]@TIME_ZONE */;
  11. /*!40103 SET TIME_ZONE=‘+00:00‘ */;
  12. /*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  13. /*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  14. /*!40101 SET @[email protected]@SQL_MODE, SQL_MODE=‘NO_AUTO_VALUE_ON_ZERO‘ */;
  15. /*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
  16. -- Current Database: `prod`
  17. CREATE DATABASE /*!32312 IF NOT EXISTS*/ `prod` /*!40100 DEFAULT CHARACTER SET latin1 */;
  18. USE `prod`;
  19. -- Table structure for table `emp`
  20. DROP TABLE IF EXISTS `emp`;
  21. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  22. /*!40101 SET character_set_client = utf8 */;
  23. CREATE TABLE `emp` (
  24. `id` int(11) DEFAULT NULL,
  25. `name` varchar(10) DEFAULT NULL
  26. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  27. /*!40101 SET character_set_client = @saved_cs_client */;
  28. -- Dumping data for table `emp`
  29. LOCK TABLES `emp` WRITE;
  30. /*!40000 ALTER TABLE `emp` DISABLE KEYS */;
  31. INSERT INTO `emp` VALUES (10,‘tom‘),(20,‘jerry‘),(30,‘rose‘);
  32. /*!40000 ALTER TABLE `emp` ENABLE KEYS */;
  33. UNLOCK TABLES;
  34. -- Dumping events for database ‘prod‘
  35. -- Dumping routines for database ‘prod‘
  36. -- Current Database: `test`
  37. CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
  38. USE `test`;
  39. -- Dumping events for database ‘test‘
  40. -- Dumping routines for database ‘test‘
  41. /*!40103 SET [email protected]_TIME_ZONE */;
  42. /*!40101 SET [email protected]_SQL_MODE */;
  43. /*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
  44. /*!40014 SET [email protected]_UNIQUE_CHECKS */;
  45. /*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
  46. /*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
  47. /*!40101 SET [email protected]_COLLATION_CONNECTION */;
  48. /*!40111 SET [email protected]_SQL_NOTES */;
  49. -- Dump completed on 2015-12-03 12:31:52

3)、停止数据库

[[email protected] mysql]# service mysql stop
Shutting down MySQL (Percona Server).......[  OK  ]
[[email protected] mysql]# mv /var/lib/mysql /var/lib/mysql55

4)、 移动旧数据库(5.5版本)的数据目录(假设是/var/lib/mysql,此处应该改为你自己的数据目录)

[[email protected] mysql]#mv /var/lib/mysql /var/lib/mysql55

[[email protected] mysql]#mkdir /var/lib/mysql

[[email protected] mysql]#chown -R mysql:mysql /var/lib/mysql

三、安装Percona Server 5.6

[[email protected] percona-56]# ls -l
total 121104
-rwxr-xr-x. 1 mysql mysql 70389368 Dec  3 11:21 Percona-Server-56-debuginfo-5.6.25-rel73.1.el6.x86_64.rpm
-rwxr-xr-x. 1 mysql mysql  6727084 Dec  3 11:21 Percona-Server-client-56-5.6.25-rel73.1.el6.x86_64.rpm
-rwxr-xr-x. 1 mysql mysql  1031588 Dec  3 11:21 Percona-Server-devel-56-5.6.25-rel73.1.el6.x86_64.rpm
-rwxr-xr-x. 1 mysql mysql 20463420 Dec  3 11:21 Percona-Server-server-56-5.6.25-rel73.1.el6.x86_64.rpm
-rwxr-xr-x. 1 mysql mysql   742496 Dec  3 11:21 Percona-Server-shared-56-5.6.25-rel73.1.el6.x86_64.rpm
-rwxr-xr-x. 1 mysql mysql 23137340 Dec  3 11:21 Percona-Server-test-56-5.6.25-rel73.1.el6.x86_64.rpm
-rwxr-xr-x. 1 mysql mysql  1508480 Dec  3 11:21 Percona-Server-tokudb-56-5.6.25-rel73.1.el6.x86_64.rpm

Percona server 5.5会与5.6的软件有冲突,所以5.6的安装需要强制安装:
[[email protected] percona-56]# rpm -ivh Percona-Server-shared-56-5.6.25-rel73.1.el6.x86_64.rpm --force

warning: Percona-Server-shared-56-5.6.25-rel73.1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:Percona-Server-shared-5########################################### [100%]

[[email protected] percona-56]# rpm -ivh Percona-Server-client-56-5.6.25-rel73.1.el6.x86_64.rpm --force --nodeps
warning: Percona-Server-client-56-5.6.25-rel73.1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:Percona-Server-client-5########################################### [100%]

[[email protected] percona-56]# rpm -ivh Percona-Server-test-56-5.6.25-rel73.1.el6.x86_64.rpm --force --nodeps
warning: Percona-Server-test-56-5.6.25-rel73.1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:Percona-Server-test-56 ########################################### [100%]

[[email protected] percona-56]# rpm -ivh Percona-Server-devel-56-5.6.25-rel73.1.el6.x86_64.rpm --force --nodeps
warning: Percona-Server-devel-56-5.6.25-rel73.1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:Percona-Server-devel-56########################################### [100%]

server软件的安装需要先卸载server 5.5:

1)、卸载server 5.5
[[email protected] percona-56]# rpm -qa |grep Percona-Server-server
Percona-Server-server-55-5.5.46-rel37.5.el6.x86_64
[[email protected] percona-56]# rpm -e Percona-Server-server-55-5.5.46-rel37.5.el6.x86_64
error: Failed dependencies:
        mysql-server is needed by (installed) akonadi-1.2.1-2.el6.x86_64
[[email protected] percona-56]# rpm -e Percona-Server-server-55-5.5.46-rel37.5.el6.x86_64 --nodeps

 

2)、安装server 5.6
[[email protected] percona-56]# rpm -ivh Percona-Server-server* --force --nodeps

warning: Percona-Server-server-56-5.6.25-rel73.1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing...                ########################################### [100%]
   1:Percona-Server-server-5########################################### [100%]

[sql] view plain copy

print?

  1. 2015-12-03 12:41:04 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  2. 2015-12-03 12:41:04 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-73.1) starting as process 4000 ...
  3. 2015-12-03 12:41:04 4000 [Note] InnoDB: Using atomics to ref count buffer pool pages
  4. 2015-12-03 12:41:04 4000 [Note] InnoDB: The InnoDB memory heap is disabled
  5. 2015-12-03 12:41:04 4000 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  6. 2015-12-03 12:41:04 4000 [Note] InnoDB: Memory barrier is not used
  7. 2015-12-03 12:41:04 4000 [Note] InnoDB: Compressed tables use zlib 1.2.3
  8. 2015-12-03 12:41:04 4000 [Note] InnoDB: Using Linux native AIO
  9. 2015-12-03 12:41:04 4000 [Note] InnoDB: Using CPU crc32 instructions
  10. 2015-12-03 12:41:04 4000 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  11. 2015-12-03 12:41:04 4000 [Note] InnoDB: Completed initialization of buffer pool
  12. 2015-12-03 12:41:04 4000 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
  13. 2015-12-03 12:41:04 4000 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
  14. 2015-12-03 12:41:04 4000 [Note] InnoDB: Database physically writes the file full: wait...
  15. 2015-12-03 12:41:04 4000 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
  16. 2015-12-03 12:41:06 4000 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
  17. 2015-12-03 12:41:08 4000 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
  18. 2015-12-03 12:41:08 4000 [Warning] InnoDB: New log files created, LSN=45781
  19. 2015-12-03 12:41:08 4000 [Note] InnoDB: Doublewrite buffer not found: creating new
  20. 2015-12-03 12:41:09 4000 [Note] InnoDB: Doublewrite buffer created
  21. 2015-12-03 12:41:09 4000 [Note] InnoDB: 128 rollback segment(s) are active.
  22. 2015-12-03 12:41:09 4000 [Warning] InnoDB: Creating foreign key constraint system tables.
  23. 2015-12-03 12:41:09 4000 [Note] InnoDB: Foreign key constraint system tables created
  24. 2015-12-03 12:41:09 4000 [Note] InnoDB: Creating tablespace and datafile system tables.
  25. 2015-12-03 12:41:09 4000 [Note] InnoDB: Tablespace and datafile system tables created.
  26. 2015-12-03 12:41:09 4000 [Note] InnoDB: Waiting for purge to start
  27. 2015-12-03 12:41:09 4000 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.25-73.1 started; log sequence number 0
  28. 2015-12-03 12:41:09 4000 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
  29. 2015-12-03 12:41:09 4000 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
  30. 2015-12-03 12:41:41 4000 [Note] Binlog end
  31. 2015-12-03 12:41:41 4000 [Note] InnoDB: FTS optimize thread exiting.
  32. 2015-12-03 12:41:41 4000 [Note] InnoDB: Starting shutdown...
  33. 2015-12-03 12:41:43 4000 [Note] InnoDB: Shutdown completed; log sequence number 1625977
  34. 2015-12-03 12:41:43 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  35. 2015-12-03 12:41:43 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-73.1) starting as process 4025 ...
  36. 2015-12-03 12:41:43 4025 [Note] InnoDB: Using atomics to ref count buffer pool pages
  37. 2015-12-03 12:41:43 4025 [Note] InnoDB: The InnoDB memory heap is disabled
  38. 2015-12-03 12:41:43 4025 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  39. 2015-12-03 12:41:43 4025 [Note] InnoDB: Memory barrier is not used
  40. 2015-12-03 12:41:43 4025 [Note] InnoDB: Compressed tables use zlib 1.2.3
  41. 2015-12-03 12:41:43 4025 [Note] InnoDB: Using Linux native AIO
  42. 2015-12-03 12:41:43 4025 [Note] InnoDB: Using CPU crc32 instructions
  43. 2015-12-03 12:41:43 4025 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  44. 2015-12-03 12:41:43 4025 [Note] InnoDB: Completed initialization of buffer pool
  45. 2015-12-03 12:41:43 4025 [Note] InnoDB: Highest supported file format is Barracuda.
  46. 2015-12-03 12:41:44 4025 [Note] InnoDB: 128 rollback segment(s) are active.
  47. 2015-12-03 12:41:44 4025 [Note] InnoDB: Waiting for purge to start
  48. 2015-12-03 12:41:44 4025 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.25-73.1 started; log sequence number 1625977
  49. 2015-12-03 12:41:44 4025 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
  50. 2015-12-03 12:41:44 4025 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
  51. 2015-12-03 12:41:44 4025 [Note] Binlog end
  52. 2015-12-03 12:41:44 4025 [Note] InnoDB: FTS optimize thread exiting.
  53. 2015-12-03 12:41:44 4025 [Note] InnoDB: Starting shutdown...
  54. 2015-12-03 12:41:46 4025 [Note] InnoDB: Shutdown completed; log sequence number 1625987
  55. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  56. To do so, start the server, then issue the following commands:
  57. /usr/bin/mysqladmin -u root password ‘new-password‘
  58. /usr/bin/mysqladmin -u root -h cent65 password ‘new-password‘
  59. Alternatively you can run:
  60. /usr/bin/mysql_secure_installation
  61. which will also give you the option of removing the test
  62. databases and anonymous user created by default.  This is
  63. strongly recommended for production servers.
  64. See the manual for more instructions.
  65. Please report any problems at
  66. https://bugs.launchpad.net/percona-server/+filebug
  67. The latest information about Percona Server is available on the web at
  68. http://www.percona.com/software/percona-server
  69. Support Percona by buying support at
  70. http://www.percona.com/products/mysql-support
  71. WARNING: Default config file /etc/my.cnf exists on the system
  72. This file will be read by default by the MySQL server
  73. If you do not want to use this, either remove it, or use the
  74. --defaults-file argument to mysqld_safe when starting the server
  75. Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
  76. Run the following commands to create these functions:
  77. mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME ‘libfnv1a_udf.so‘"
  78. mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME ‘libfnv_udf.so‘"
  79. mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME ‘libmurmur_udf.so‘"
  80. See http://www.percona.com/doc/percona-server/5.6/management/udf_percona_toolkit.html for more details

------------至此,Percona Server 5.6安装成功 !

四、将数据import到server 5.6

 

1、启动mysql server

[[email protected] percona-56]# service mysql start
Starting MySQL (Percona Server).[  OK  ]
[[email protected] percona-56]# netstat -an|grep :3306
tcp        0      0 :::3306                     :::*                        LISTEN

2、导入用户权限表
[[email protected] percona-56]# mysql -u root -p </home/mysql/grants.sql

Enter password: 
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)

[[email protected] percona-56]# mysqladmin -u root password "oracle"
Warning: Using a password on the command line interface can be insecure.

[[email protected] percona-56]# mysql -u root -p </home/mysql/grants.sql
Enter password:

3、导入备份数据
[[email protected] percona-56]# mysql -uroot -p -e "SET GLOBAL max_allowed_packet=1024*1024*1024"

Enter password: 
[[email protected] percona-56]# mysql -uroot -p --max-allowed-packet=1G < /home/mysql/full-data-dump.sql
Enter password: 
[[email protected] percona-56]#

5、连接server,验证数据
[[email protected] percona-56]# mysql -uroot -p

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.25-73.1 Percona Server (GPL), Release 73.1, Revision 07b797f
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| prod               |
| test               |
+--------------------+
5 rows in set (0.00 sec)

mysql> use prod;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_prod |
+----------------+
| emp            |
+----------------+
1 row in set (0.00 sec)

查看表信息:
mysql> select * from emp;

+------+-------+
| id   | name  |
+------+-------+
|   10 | tom   |
|   20 | jerry |
|   30 | rose  |
+------+-------+
3 rows in set (0.00 sec)

---------数据库可以正常访问,至此升级结束!

 

    此时, 所有的表都在MySQL 5.6中重建及重新加载完成,所以所有的二进制文件对MySQL 5.6可用. 同时也你完成了最干净/最稳定的升级过程,你可以恢复你的应用- 这个升级过程和valina MySQL与Percona Server的升级过程是一样的.甚至你可以把Oracle MySQL升级到Percona Server. 比如: 把Oracle MySQL 5.5升级到Percona Server 5.6. 再次强调: MySQL的升级过程和Percona Server的升级过程是一样的,只需要将Percona Server 替换成Oracle MySQL即可.

时间: 2024-07-30 10:30:01

Percona-mysql server 5.5升级5.6的相关文章

zabbix:percona mysql监控插件使用方法

一.配置Zabbix Agent 1.插件安装及配置 下载地址:https://www.percona.com/downloads/percona-monitoring-plugins/ 安装percona的监控mysql软件包: rpm -ivh percona-zabbix-templates-1.1.7-1.noarch.rpm 查看rpm安装的文件路径: [[email protected] ~]# rpm -ql percona-zabbix-templates-1.1.7-1.noa

MySQL Study之--Percona server 5.5升级5.6

MySQL Study之--Percona server 5.5升级5.6 系统环境:      操作系统:CentOS_6.5(64)            MySQL:   Percona server 5.5(5.6) 一.升级的目的 为什么MySQL升级是必须的? 原因有很多,比如:为了使用新增的特性,基于性能方面的考量, 修复的bug. 但是在没有充分的测试以前就应用到你的应用中是非常危险的, 因为升级可以能会让你的应用不能正常运作- 也可能引起性能的问题. 此外, 我建议你关注MyS

percona innobackupex 遇到 connect to MySQL server as DBD::mysql module is not installed 问题

percona innobackupex connect to MySQL server as DBD::mysql module is not installed [[email protected] software]# innobackupex --user=root --password=123456 /data/backup/ InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy and Pe

mysql二进制安装,升级,多实例部署

目标 理解线上部署考虑的因素 学会编译安装以及二进制安装mysql 学会升级mysql 学会多实例部署mysql数据库 学会合理部署mysql线上库 考虑因素: 版本选择,5.1,5.5还是5.6? 分支选择,官方社区版?percona server?mariadb? 推荐官方版,简单易上手 安装方式,包安装?二进制包安装?源码安装? 线上推荐二进制包安装 路径配置,参数配置(尽量模板化,标准化) 一个实例多个库,or多个实例单个库? 二进制安装mysql 下载软件安装包 解压放到指定目录(比如

在CentOS上把MySQL从5.5升级到5.6(转)

http://www.th7.cn/db/mysql/201408/66064.shtml 在CentOS上把MySQL从5.5升级到5.6 摘要:本文记录了在CentOS 6.3上,把MySQL从5.5.28升级到5.6.19的过程. 1. 概述 在我做的一个项目中,最近我对生产服务器上的一系列系统软件进行了升级,包括git.nginx.MySQL和PHP.这篇文章讲的是升级MySQL的过程,其他软件的升级将在其他文章中介绍. 在我加入这个项目之前,网络服务器MySQL已经安装设置好了,我只是

MySQL从5.5升级到5.6,TIMESTAMP的变化

前言 前段时间,系统MySQL从5.5升级到了5.6,系统出现了大量的异常.大部分异常引起原因是由于TIMESTAMP的行为发生了变化. TIMESTAMP在MySQL5.5中的行为 第一个未设置默认值的TIMESTAMP NOT NULL字段隐式默认值: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 后面未设置默认值的TIMESTAMP NOT NULL字段隐式默认值: 0000-00-00 00:00:00 TIMESTAMP NOT NULL字

Failed to connect to MySQL server to detect version.

用xtrabackup进行数据备份恢复时出现如下问题: InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy and Percona Inc 2009-2011.  All Rights Reserved. This software is published under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991. option_ibback

MySQL报错:ERROR 2013 (HY000): Lost connection to MySQL server during query

首先贴上实验用各版本: OS:CentOS 6.5 MySQL: mysql> select version ();+------------+| version () |+------------+| 5.6.22     |+------------+1 row in set (0.00 sec) 事情是这样的:本来是要在虚机上搭建一个wordpress做实验,刚创建完数据库,就在赋权额时候发生不在计划的错误: mysql>grant all on wordpress.* to [emai

ubuntu 14.04 安装mysql server初级教程

序,mysql数据库是开源的,被大多数企业所使用 目录 一.apt-get install 软件安装原理剖析二.安装mysql server三.配置和管理msyql 一.apt-get install 软件安装原理剖析 /etc/apt/sources.list 这个文件很重要,里面放了一些软件资源的库地址,我们每次利用apt-get install命令安装软件时,都是在读取这个文件. Ubuntu 软件仓库被分为四个部分:main(主要的), restricted(受限的), universe