Upgrading mysql version 5.5.30 to 5.6.10


Published on

Upgrading Mysql version 5.5 to 5.6

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Upgrading mysql version 5.5.30 to 5.6.10

  1. 1. Upgrading MySQL 5.5.30 to 5.6.10 on Linux:Step: 1First downloaded particular version of MySQL and copy in to mount pointin thisscenario we have 5.5.30 –log version on LinuxNow we need to upgrade 5.6.10 in Linuxversion:Before upgrading,
  2. 2. Step 2: We now have our rpm’s to upgrade our server to MySQL 5.6.10Before we proceed further, stop existing MySQL Server. Run the following command tostop your server [Assuming your init.d start-up script in named as MySQL, you can checkthat in /etc/init.d directory]Servicemysql stopStep 3:Now move the data directory under /var/lib/mysqlto /var/lib/mysql_55.Run the following command in order to move. [If you used custom path when you installedMySQL 5.5 then change below command appropriately]mv/var/lib/mysql/ /var/lib/mysql_55Step 4:Now you can securely remove the existing installation of MySQL 5.5 rpm’s fromyour server, before we install the new MySQL 5.6 database engine. Check what existingpackages are installed on our existing database server that corresponds to MySQL 5.5engine. To do that runs the following commandRpm–qa|grep–I mysqlStep 5:Running the above command returns the following packages as that are currentlyinstalled in existing database server. Now remove them one by one from server in orderfor us to install MySQL 5.6 engine.
  3. 3. To remove we can simply run the followingYum remove MySQL-server-5.5.30-1.rhel5 MySQL-client-5.5.30-1.rhel5 MySQL-shared-5.5.30-1.rhelStep 6:Now you have remove all MySQL 5.5 related libraries that correspond to MySQL 5.5database engine. Nowlet’s install MySQL 5.6.10 from the rpm’s that we downloadedearlier. To install them just run the following commands.Rpm–ivhMySQL-shared-5.6.10-1.rhel5.rpmRpm-ivhMySQL-client-5.6.10-1.el6.rhel5.rpmRpm–ivhMySQL-server-5.6.10-1.el6.rhel5.rpm
  4. 4. Log file:[root@INVIRH54DB3 mysql]# rpm -ivh MySQL-server-5.6.10-1.rhel5.x86_64.rpmPreparing... ########################################### [100%]1:MySQL-server ########################################### [100%]2013-04-12 12:27:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentation for moredetails).2013-04-12 12:27:10 2b96105a53a0 InnoDB: Warning: Usinginnodb_additional_mem_pool_size is DEPRECATED. This optionmay be removed in future releases, together with the option innodb_use_sys_malloc andwith the InnoDBsinternal memory allocator.2013-04-12 12:27:10 6419 [Note] InnoDB: The InnoDB memory heap is disabled2013-04-12 12:27:10 6419 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2013-04-12 12:27:10 6419 [Note] InnoDB: Compressed tables use zlib 1.2.32013-04-12 12:27:10 6419 [Note] InnoDB: CPU does not support crc32 instructions2013-04-12 12:27:10 6419 [Note] InnoDB: Using Linux native AIO2013-04-12 12:27:10 6419 [Note] InnoDB: Initializing buffer pool, size = 16.0M2013-04-12 12:27:10 6419 [Note] InnoDB: Completed initialization of buffer pool2013-04-12 12:27:10 6419 [Note] InnoDB: The first specified data file/var/lib/mysql/ibdata1 did not exist: a new database to be created!2013-04-12 12:27:10 6419 [Note] InnoDB: Setting file /var/lib/mysql/ibdata1 size to 10MB2013-04-12 12:27:10 6419 [Note] InnoDB: Database physically writes the file full:wait...2013-04-12 12:27:10 6419 [Note] InnoDB: Setting log file/var/lib/mysql/ib_logfile101 size to 5 MB2013-04-12 12:27:10 6419 [Note] InnoDB: Settinglog file /var/lib/mysql/ib_logfile1 size to 5 MB2013-04-12 12:27:10 6419 [Note] InnoDB:Renaming log file /var/lib/mysql/ib_logfile101 to /var/lib/mysql/ib_logfile02013-04-12 12:27:10 6419 [Warning] InnoDB: New log files created, LSN=457812013-04-12 12:27:10 6419 [Note] InnoDB: Doublewrite buffer not found: creating new2013-04-12 12:27:10 6419 [Note] InnoDB: Doublewrite buffer created2013-04-12 12:27:10 6419 [Note] InnoDB: 128 rollback segment(s) are active.2013-04-12 12:27:10 6419 [Warning] InnoDB: Creating foreign key constraint systemtables.2013-04-12 12:27:10 6419 [Note] InnoDB: Foreign key constraint system tablescreated2013-04-12 12:27:10 6419 [Note] InnoDB: Creating tablespace and datafile systemtables.2013-04-12 12:27:10 6419 [Note] InnoDB: Tablespace and datafile system tablescreated.2013-04-12 12:27:10 6419 [Note] InnoDB: Waiting for purge to start2013-04-1212:27:10 6419 [Note] InnoDB: 1.2.10 started; log sequence number 0A random root password has been set. You will find it in /root/.mysql_secret.2013-04-12 12:27:10 6419 [Note] Binlog end
  5. 5. 2013-04-12 12:27:10 6419 [Note] InnoDB: FTS optimize thread exiting.2013-04-12 12:27:10 6419 [Note] InnoDB: Starting shutdown...2013-04-12 12:27:12 6419 [Note] InnoDB: Shutdown completed; log sequence number16259842013-04-12 12:27:12 0 [Warning] TIMESTAMP with implicit DEFAULT value isdeprecated. Please use --explicit_defaults_for_timestamp server option (seedocumentation for more details).2013-04-12 12:27:12 2ba3a48293a0 InnoDB: Warning:Using innodb_additional_mem_pool_size is DEPRECATED. This optionmay be removed in future releases, together with the option innodb_use_sys_malloc andwith the InnoDBsinternal memory allocator.2013-04-12 12:27:12 6442 [Note] InnoDB:The InnoDB memory heap is disabled2013-04-12 12:27:12 6442 [Note] InnoDB: Mutexesand rw_locks use GCC atomic built-ins 2013-04-12 12:27:12 6442 [Note] InnoDB:Compressed tables use zlib 1.2.32013-04-12 12:27:12 6442 [Note] InnoDB: CPU does notsupport crc32 instructions2013-04-12 12:27:12 6442 [Note] InnoDB: Using Linux native AIO2013-04-12 12:27:12 6442 [Note] InnoDB: Initializing buffer pool, size = 16.0M2013-04-12 12:27:12 6442 [Note] InnoDB: Completed initialization of buffer pool2013-04-12 12:27:12 6442 [Note] InnoDB: Highest supported file format is Barracuda.2013-04-12 12:27:12 6442 [Note] InnoDB: 128 rollback segment(s) are active.2013-04-12 12:27:12 6442 [Note] InnoDB: Waiting for purge to start2013-04-12 12:27:12 6442 [Note] InnoDB: 1.2.10 started; log sequence number 16259842013-04-12 12:27:12 6442 [Note] Binlog end2013-04-12 12:27:12 6442 [Note] InnoDB: FTS optimize thread exiting.2013-04-12 12:27:12 6442 [Note] InnoDB: Starting shutdown...2013-04-12 12:27:14 6442 [Note] InnoDB: Shutdown completed; log sequence number1625994A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !You will find that password in /root/.mysql_secret.You must change that password on your first connect,No other statement but SET PASSWORD will be accepted.See the manual for the semantics of the password expired flag.Also, the account for the anonymous user has been removed.In addition, you can run:/usr/bin/mysql_secure_installationWhich will also give you the option of removing the test database?This is strongly recommended for production servers.See the manual for more instructions.Please report any problems with the /usr/bin/mysqlbug script!The latest information about MySQL is available on the web athttp://www.mysql.com
  6. 6. Support MySQL by buying support/licenses at http://shop.mysql.comWARNING: Found existing config file /usr/my.cnf on the system.Because this file might be in use, it was not replaced,But was used in bootstrap (unless you used --defaults-file)And when you later start the server.The new default config file was created as /usr/my-new.cnf,Please compare it with your file and take the changes you need.WARNING: Default config file /etc/my.cnf exists on the systemThis file will be read by default by the MySQL serverIf you do not want to use this, either remove it, or use the--defaults-file argument to mysqld_safe when starting the serverStep 7:We are now done with installing MySQL 5.6 server. Now before we start the serverwe need to move back the data directory that we moved earlier and put back to where itwas. I will be copying back rather than moving as a failsafe if the upgrade fails. Then westill have the original data directory in place to fix things up or install MySQL 5.5 serverbacks to its place for rolling back the upgrade process.Mv/var/lib/mysql /var/lib/mysql_56_cleanCp-R/var/lib/mysql_55 /var/lib/mysqlStep 8:Now we have our data directory back to its place. Right now we are in a state thatour engine libraries correspond to MySQL 5.6.10 and our data directory is of MySQL 5.5.We need to upgrade our data directory to be compatible with MySQL 5.6 database engine.In order to proceed further we need to start the database engine now.Servicemysql start
  7. 7. Step 9:There will be an error starting the database engine as shown above:Starting MySQL.ERROR! The server quit without updating PID file (/var/lib/mysql/opensourcedbms.pid)Database engine will fail to start as permissions on data directory are wrong. To fix thatrun the following command.Chown-R mysql:mysql/var/lib/mysql
  8. 8. Step 10: Now try starting the database server again with same command.Servicemysql startAnd you should be able to successfully start it. [If you did not, you might have datadirectories installed in a different path or custom config file paths etc., check you databaselogs and see if those tell something about it. Please put that in this blog comments and Iwill try to solve that if possible based on my understanding]Step 11:Now let’s upgrade the data directories to be compatible with MySQL 5.6 engine toplay nice with this new engine. To upgrade we need to run mysql_upgrade. This utilitychecks your tables, and attempts to repair them if necessary. It also updates your granttables to make sure that they have the current structure so that you can take advantage ofany new capabilities. Please use an existing super user that you have inyour database [5.5]
  9. 9. engine to run this utility. Please change the host/user/password according to yourparameters/settings.mysql_upgrade –hHostname –u root-pHere password is mysqlStep 12:Mysql_upgrade utility should start fixing your existing tables. Now you havesuccessfully updated your data directory as well. This completes full upgrade of MySQL 5.5database server to MySQL 5.6 database server. Try connecting from any existing client andyou should be able to connect successfully to this database server.
  10. 10. Note:There are certainly a lot of config parameter changes / feature changes in MySQL 5.6database version. I highly recommend going through those new welcome additions inMySQL 5.6 version and tune your database server accordingly [Also go through ServerAdministration / Security areas from 5.6 Manual for good understanding]. Also thisupgrade is a lot straight forward as I did not have to deal with existing server configparameters, custom paths etc., I would say think through this tutorial and act according toyour environment/needs.Before you proceed to do this on your production servers make sure that you block 3306[Or whatever port your database server runs on] port from your iptables and test thisprocess in pre-production environments at-least couple of times.Last but not least makesure that this new MySQL server is enabled to auto start when server restarts.
  11. 11. Whats New in MySQL 5.6?http://dev.mysql.com/tech-resources/articles/whats-new-in-mysql-5.6.html