{"id":3827,"date":"2010-12-22T14:07:02","date_gmt":"2010-12-22T19:07:02","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=3827"},"modified":"2010-12-22T14:07:02","modified_gmt":"2010-12-22T19:07:02","slug":"3827","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/3827\/","title":{"rendered":"MySQL 5.5 upgrade"},"content":{"rendered":"<p>From <a href=\"http:\/\/www.ovaistariq.net\/490\/a-step-by-step-guide-to-upgrading-to-mysql-5-5\" target=\"_blank\" rel=\"noopener noreferrer\">ovaistariq.net<\/a><br \/>\n<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/upgrading-from-previous-series.html\" target=\"_blank\" rel=\"noopener noreferrer\">Reference MySQL Documentation Here<\/a><\/p>\n<p>MySQL 5.5 has created a lot of hype and its not just hype, there are major performance enhancements not only in the MySQL server itself but in the newer InnoDB plugin shipped with MySQL 5.5. That\u2019s exactly the reason why I have myself upgraded to MySQL 5.5 (The server running this blog run MySQL 5.5). Now since I haven\u2019t come across a guide to help in upgrading to MySQL 5.5, I thought why not make one myself. So here goes nothing!<\/p>\n<p><!--more--><\/p>\n<p><strong>Download the binary<\/strong><br \/>\n<code><br \/>\n$ cd \/root\/<br \/>\n$ wget http:\/\/dev.mysql.com\/get\/Downloads\/MySQL-5.5\/mysql-5.5.8-linux2.6-i686.tar.gz\/from\/http:\/\/mysql.oss.eznetsols.org\/<br \/>\n$ mv index.html mysql-5.5.8-linux2.6-i686.tar.gz<\/code><\/p>\n<p><strong>Backup the MySQL configuration<\/strong><br \/>\n<code><br \/>\n$ mkdir \/root\/mysql-5.1-conf<br \/>\n$ cp -R \/etc\/mysql\/ \/root\/mysql-5.1-conf<\/code><\/p>\n<p><strong>Backup the data directory<\/strong><br \/>\nWe will be backing up the data in the form of SQL dump as well as by copying the data files over to a safe place, just to be 100% sure about the data not getting lost.<br \/>\n<code><br \/>\n$ mkdir \/root\/mysql-5.1-data<br \/>\n$ cp -R \/var\/lib\/mysql\/ \/root\/mysql-5.1-data<\/code><\/p>\n<p><strong>Backup the data as SQL dump<\/strong><br \/>\nBackup the mysql database separately and not with all the other databases, because we are going to need it before we restore all the databases.<br \/>\n<code><br \/>\n$ mkdir \/root\/mysql-5.1-dump<br \/>\n$ mysqldump -u user_name -p --databases mysql > \/root\/mysql-5.1-dump\/mysql.sql<br \/>\n$ mysqldump -u user_name -p --databases db_name > \/root\/mysql-5.1-dump\/db_name.sql<\/code><\/p>\n<p><strong>Install the asynchronous I\/O library<\/strong><br \/>\nThis is so that we can take advantage of the asynchronous I\/O capability in the new InnoDB plugin that ships with MySQL 5.5<br \/>\n<code><br \/>\n$ apt-get install libaio-dev<\/code><\/p>\n<p><strong>Untar the archive<\/strong><br \/>\n<code>$ tar xzvf mysql-5.5.8-linux2.6-i686.tar.gz<\/code><\/p>\n<p><strong>Copy or move the untarred MySQL directory to the installation directory<\/strong><br \/>\n<code><br \/>\n$ cp -R mysql-5.5.8-linux2.6-i686 \/usr\/local\/<br \/>\n$ cd \/usr\/local\/<br \/>\n$ ln -s mysql-5.5.8-linux2.6-i686 mysql<\/code><\/p>\n<p><strong>Remove the older version of MySQL<\/strong><br \/>\nNow is the time to remove the older version of MySQL, in this case I assume the older version to be MySQL 5.1<br \/>\n<code><br \/>\n$ apt-get remove mysql-server-5.1<br \/>\n$ apt-get autoremove<br \/>\n$ apt-get remove mysql-client<br \/>\n$ apt-get autoremove<\/code><\/p>\n<p><strong>Add the path to MySQL bin directory to the PATH variable<\/strong><br \/>\n<code><br \/>\n$ vim \/etc\/environment<br \/>\nPATH=\"\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/usr\/games:\/usr\/local\/mysql\/bin\"<\/code><br \/>\nSet the correct file and directory permissions on the MySQL installation directory<\/p>\n<p><strong>Setting correct permissions is very important, make sure that all the files except those under the data directory are owned by root. The data directory has to be owned by the user mysql.<br \/>\n<\/strong><br \/>\n<code><br \/>\n$ cd \/usr\/local\/mysql<br \/>\n$ chown -R mysql:mysql data<\/code><\/p>\n<p><strong>Create the socket directory<\/strong><br \/>\nHere again, setting the correct permissions on the socket directory is very important, otherwise MySQL would not run.<br \/>\n<code><br \/>\n$ mkdir \/var\/run\/mysqld\/<br \/>\n$ chown -R mysql:mysql \/var\/run\/mysqld\/<\/code><\/p>\n<p><strong>Copy the sample MySQL configuration file to the etc directory and setup the paths<\/strong><br \/>\n<code><br \/>\n$ cd \/usr\/local\/mysql\/support-files\/<br \/>\n$ cp my-large.cnf \/etc\/my.cnf<\/code><br \/>\nNow edit \/etc\/my.cnf so that it has the following values:<br \/>\n<code><br \/>\nuser            = mysql<br \/>\nsocket          = \/var\/run\/mysqld\/mysqld.sock<br \/>\nport            = 3306<br \/>\nbasedir         = \/usr\/local\/mysql<br \/>\ndatadir         = \/usr\/local\/mysql\/data<br \/>\ntmpdir          = \/tmp<br \/>\nlog_error       = \/var\/log\/mysql\/error.log<\/code><\/p>\n<p><strong>Copy the MySQL server startup script to the startup directory<\/strong><br \/>\nThe MySQL startup script has to be placed in the directory where all the startup scripts reside, so that MySQL starts on system startup. Make sure that you make the startup script executable, and update the rc.d database to notify the system about the presence of a new startup script.<br \/>\n<code><br \/>\n$ cd \/usr\/local\/mysql\/support-files\/<br \/>\n$ cp mysql.server \/etc\/init.d\/mysql<br \/>\n$ chmod +x \/etc\/init.d\/mysql<br \/>\n$ update-rc.d mysql defaults<\/code><\/p>\n<p><strong>Remove the MySQL files from the older version<\/strong><br \/>\nMake sure you don\u2019t delete files belonging to the new version we are installing.<br \/>\n<code><br \/>\n$ rm -R \/var\/lib\/mysql<br \/>\n$ rm -R \/etc\/mysql<br \/>\n$ rm -R \/usr\/lib\/mysql<\/code><br \/>\nWhen starting the MySQL server for the first time after the new installation, it has to be started without the grants table, for two reasons. Firstly, because we want to retain the users and privileges data from the previous install of MySQL and secondly, because the schema of the grants table in MySQL 5.5 has changed.<br \/>\nSo what we will do is start MySQL without the grants table, import the users and privileges data we backed up earlier in this guide and run the mysql_upgrade script that modifies the schema of the grants table to be in sync with that in MySQL 5.5. After that we will be able to run MySQL normally and have all the users and privileges same as in the previous version we had.<\/p>\n<p><strong>Start MySQL server without grants table.<\/strong><br \/>\n<code><br \/>\n$ mysqld --skip-grant-tables --user=mysql<\/code><\/p>\n<p><strong>Load the MySQL users and privileges data we backed up earlier<\/strong><br \/>\n<code><br \/>\n$ cd \/root\/mysql-5.1-backup\/dump\/<br \/>\n$ mysql < mysql.sql<\/code><\/p>\n<p><strong>Run the upgrade script so that everything gets upgraded to the version 5.5<\/strong><br \/>\n<\/code><code><br \/>\n$ mysql_upgrade<\/code><\/p>\n<p><strong>Stop the server and start it normally<\/strong><br \/>\n<code><br \/>\n$ \/etc\/init.d\/mysql stop<br \/>\n$ \/etc\/init.d\/mysql start<\/code><\/p>\n<p>There you go, you have a MySQL 5.5 server up and running in no time! Do share your thoughts if you try out MySQL 5.5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From ovaistariq.net Reference MySQL Documentation Here MySQL 5.5 has created a lot of hype and its not just hype, there are major performance enhancements not only in the MySQL server itself but in the newer InnoDB plugin shipped with MySQL 5.5. That\u2019s exactly the reason why I have myself upgraded to MySQL 5.5 (The server&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/3827\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-3827","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL 5.5 upgrade - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/3827\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL 5.5 upgrade - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"From ovaistariq.net Reference MySQL Documentation Here MySQL 5.5 has created a lot of hype and its not just hype, there are major performance enhancements not only in the MySQL server itself but in the newer InnoDB plugin shipped with MySQL 5.5. That\u2019s exactly the reason why I have myself upgraded to MySQL 5.5 (The server... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/3827\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2010-12-22T19:07:02+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"MySQL 5.5 upgrade\",\"datePublished\":\"2010-12-22T19:07:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/\"},\"wordCount\":610,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/\",\"name\":\"MySQL 5.5 upgrade - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2010-12-22T19:07:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/3827\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL 5.5 upgrade\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL 5.5 upgrade - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/3827\/","og_locale":"en_US","og_type":"article","og_title":"MySQL 5.5 upgrade - Linux Shtuff","og_description":"From ovaistariq.net Reference MySQL Documentation Here MySQL 5.5 has created a lot of hype and its not just hype, there are major performance enhancements not only in the MySQL server itself but in the newer InnoDB plugin shipped with MySQL 5.5. That\u2019s exactly the reason why I have myself upgraded to MySQL 5.5 (The server... Read More","og_url":"https:\/\/g33kinfo.com\/info\/3827\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2010-12-22T19:07:02+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/3827\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/3827\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"MySQL 5.5 upgrade","datePublished":"2010-12-22T19:07:02+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/3827\/"},"wordCount":610,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/3827\/","url":"https:\/\/g33kinfo.com\/info\/3827\/","name":"MySQL 5.5 upgrade - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2010-12-22T19:07:02+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/3827\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/3827\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/3827\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"MySQL 5.5 upgrade"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=3827"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3827\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=3827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=3827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=3827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}