{"id":444,"date":"2020-09-16T14:48:51","date_gmt":"2020-09-16T14:48:51","guid":{"rendered":"https:\/\/amirli.com\/?p=444"},"modified":"2020-11-18T12:36:29","modified_gmt":"2020-11-18T12:36:29","slug":"how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress","status":"publish","type":"post","link":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/","title":{"rendered":"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running WordPress"},"content":{"rendered":"

I had MySQL 5.5.60 installation on an AWS<\/abbr> EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life<\/a> for 5.5 has long expired. Additionally, WordPress started to suggest using version 5.6 later.<\/p>\n

Before going to upgrade existing MySQL installation, -ssh<\/code> your instance and check the version of your existing service with the following command:<\/p>\n

mysqld --version<\/code><\/pre>\n

<\/code><\/p>\n

Note<\/strong>: You should be able to run commands as the root<\/strong> user in order to complete the upgrade. Running sudo su<\/code> logs you in as the root user. You may be asked a password for the user.<\/p><\/blockquote>\n

 <\/p>\n

As a person knowing very little about Linux, MySQL, and other systems\/services alike, my main concern was if I was going to lose the existing MySQL data after the upgrade. The fact is I did not lose any data after the upgrade. But I took some actions beforehand in case I mess up: took a snapshot of the EC2 volume attached to the running instance and copied MySQL data to a temporary folder using -ssh access.\u00a0 If your MySQL data is in \/var\/lib\/mysql<\/code> and if you want to copy the data to \/tmp\/mysql.bck<\/code>, you can use this command in your Linux server:<\/p>\n

cp -R \/var\/lib\/mysql \/tmp\/mysql.bck<\/code><\/pre>\n

This will create mysql.bck<\/code> folder within the tmp<\/code> folder and will copy existing MySQL files to the mysql.bck<\/code> folder.<\/p>\n

Upgrading to 5.6<\/h3>\n

You should first remove the existing MySQL service installation. Assuming your MySQL version is 5.5 and you ssh<\/code> as the root user, you should run this command to remove the existing installation:<\/p>\n

sudo yum remove mysql55-server<\/span><\/code><\/pre>\n

Now you need to install the version 5.6. The following command will do it for you:<\/p>\n

sudo yum install mysql56-server<\/span><\/code><\/pre>\n

After running this command, you may encounter an error stating a conflict with another existing service. This was an error I got:<\/p>\n

Error: perl-DBD-MySQL56 conflicts with perl-DBD-MySQL55-4.023-5.23.amzn1.x86_64\r\n<\/span><\/code><\/pre>\n

This can be solved by just removing conflicting installations. The new installation will upgrade the removed service too as you can see from the error message. This command will remove the conflicting service:<\/p>\n

sudo yum remove perl-DBD-MySQL55\r\n<\/span><\/code><\/pre>\n

After removing the conflicting installation, run the command for the 5.6 installation again. This should complete the installation. Go ahead and check the version. You may need to start the MySQL service after installation. This code will do that:<\/p>\n

sudo service mysqld <\/span>start<\/span><\/code><\/pre>\n

Upgrading to 5.7<\/h3>\n

The same steps can be taken to upgrade to version 5.7: mysql-56<\/code> should be removed and mysql-57<\/code> should be installed. In other words, run the following commands one-by-one:<\/p>\n

sudo yum remove mysql56-server\r\nsudo yum install mysql57-server\r\nsudo service mysqld <\/span>start<\/span><\/code><\/pre>\n

This is it. End of life MySQL 5.7 is expected to be October 21, 2023, and it means we have some time to dig into upgrading to version 8. Hope you enjoy this post.<\/p>\n","protected":false},"excerpt":{"rendered":"

I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life…<\/p>\n","protected":false},"author":1,"featured_media":448,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-computing"],"acf":[],"yoast_head":"\nHow to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running Wordpress | Mehran Amirli<\/title>\n<meta name=\"description\" content=\"I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life for 5.5 has long expired.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running Wordpress | Mehran Amirli\" \/>\n<meta property=\"og:description\" content=\"I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life for 5.5 has long expired.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Mehran Amirli\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-16T14:48:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-18T12:36:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"375\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mehran Amirli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mehran Amirli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\"},\"author\":{\"name\":\"Mehran Amirli\",\"@id\":\"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf\"},\"headline\":\"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running WordPress\",\"datePublished\":\"2020-09-16T14:48:51+00:00\",\"dateModified\":\"2020-11-18T12:36:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\"},\"wordCount\":417,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf\"},\"image\":{\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1\",\"articleSection\":[\"Cloud Computing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\",\"url\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\",\"name\":\"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running Wordpress | Mehran Amirli\",\"isPartOf\":{\"@id\":\"https:\/\/amirli.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1\",\"datePublished\":\"2020-09-16T14:48:51+00:00\",\"dateModified\":\"2020-11-18T12:36:29+00:00\",\"description\":\"I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life for 5.5 has long expired.\",\"breadcrumb\":{\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1\",\"width\":640,\"height\":375},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/amirli.com\/en\/home-2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/amirli.com\/#website\",\"url\":\"https:\/\/amirli.com\/\",\"name\":\"Mehran Amirli\",\"description\":\"Personal Blog\",\"publisher\":{\"@id\":\"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/amirli.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf\",\"name\":\"Mehran Amirli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/amirli.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2023\/04\/PAN_4225.jpg?fit=2000%2C2000&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2023\/04\/PAN_4225.jpg?fit=2000%2C2000&ssl=1\",\"width\":\"2000\",\"height\":\"2000\",\"caption\":\"Mehran Amirli\"},\"logo\":{\"@id\":\"https:\/\/amirli.com\/#\/schema\/person\/image\/\"},\"description\":\"H\u00fcquq\u015f\u00fcnas\",\"url\":\"https:\/\/amirli.com\/en\/author\/mehran-amirli\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running Wordpress | Mehran Amirli","description":"I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life for 5.5 has long expired.","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:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running Wordpress | Mehran Amirli","og_description":"I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life for 5.5 has long expired.","og_url":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/","og_site_name":"Mehran Amirli","article_published_time":"2020-09-16T14:48:51+00:00","article_modified_time":"2020-11-18T12:36:29+00:00","og_image":[{"width":640,"height":375,"url":"https:\/\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg","type":"image\/jpeg"}],"author":"Mehran Amirli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mehran Amirli","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#article","isPartOf":{"@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/"},"author":{"name":"Mehran Amirli","@id":"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf"},"headline":"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running WordPress","datePublished":"2020-09-16T14:48:51+00:00","dateModified":"2020-11-18T12:36:29+00:00","mainEntityOfPage":{"@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/"},"wordCount":417,"commentCount":0,"publisher":{"@id":"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf"},"image":{"@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1","articleSection":["Cloud Computing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/","url":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/","name":"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running Wordpress | Mehran Amirli","isPartOf":{"@id":"https:\/\/amirli.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1","datePublished":"2020-09-16T14:48:51+00:00","dateModified":"2020-11-18T12:36:29+00:00","description":"I had MySQL 5.5.60 installation on an AWS EC2 instance (Linux 2018.03) and had to upgrade it to 5.7 as the official end of life for 5.5 has long expired.","breadcrumb":{"@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#primaryimage","url":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1","contentUrl":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1","width":640,"height":375},{"@type":"BreadcrumbList","@id":"https:\/\/amirli.com\/en\/how-to-upgrade-mysql-from-5-5-to-5-6-5-7-on-ec2-linux-server-running-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/amirli.com\/en\/home-2\/"},{"@type":"ListItem","position":2,"name":"How to upgrade MySQL from 5.5 to 5.6\/5.7 on EC2 Linux server running WordPress"}]},{"@type":"WebSite","@id":"https:\/\/amirli.com\/#website","url":"https:\/\/amirli.com\/","name":"Mehran Amirli","description":"Personal Blog","publisher":{"@id":"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/amirli.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/amirli.com\/#\/schema\/person\/59e5ab4ce71b735ed0d1c9bba1573aaf","name":"Mehran Amirli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/amirli.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2023\/04\/PAN_4225.jpg?fit=2000%2C2000&ssl=1","contentUrl":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2023\/04\/PAN_4225.jpg?fit=2000%2C2000&ssl=1","width":"2000","height":"2000","caption":"Mehran Amirli"},"logo":{"@id":"https:\/\/amirli.com\/#\/schema\/person\/image\/"},"description":"H\u00fcquq\u015f\u00fcnas","url":"https:\/\/amirli.com\/en\/author\/mehran-amirli\/"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/amirli.com\/wp-content\/uploads\/2020\/09\/mysql_logo.jpg?fit=640%2C375&ssl=1","_links":{"self":[{"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":5,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"predecessor-version":[{"id":446,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/posts\/444\/revisions\/446"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/media\/448"}],"wp:attachment":[{"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amirli.com\/en\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}