{"id":7647,"date":"2020-06-09T05:43:24","date_gmt":"2020-06-09T05:43:24","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=7647"},"modified":"2020-06-09T05:45:52","modified_gmt":"2020-06-09T05:45:52","slug":"how-to-install-the-latest-mysql-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/","title":{"rendered":"How To Install the Latest MySQL on Ubuntu 18.04?"},"content":{"rendered":"<p>A prominent open source database management system, MySQL is used to store and recover data for a several popular applications. M means MySQL in the LAMP stack, a commonly used set of open source software that comprises of Linux, the Apache web server, and the PHP programming language other than MySQL.<\/p>\n<p>For using the newly released features, it is often essential to install a more up-to-date version of MySQL than that is offered by your Linux distribution. It is convenient for the MySQL developers to maintain their own software repository that we can use to install the latest version easily and keep it up to date.<\/p>\n<p>For installing the latest version of MySQL, we will add this repository, install the MySQL software itself, secure the install, and lastly test that MySQL is running and is responsive to commands.<\/p>\n<h3>Prerequisites<\/h3>\n<p>Prior to starting this tutorial, you will need:<br \/>\n\u2022 An Ubuntu 18.04 server with a non-root and sudo-enabled user.<\/p>\n<h3>Step 1 \u2014 Adding the MySQL Software Repository<\/h3>\n<p>You get a .deb package offered by the MySQL developers that manages the configuration and installation of the official MySQL software repositories. After setting up the repositories, user can use Ubuntu&#8217;s standard apt command for software installation. Then download this .deb file with curl and then install it with the dpkg command.<\/p>\n<p>Now, load the MySQL download page in your web browser. The Download button is in the lower-right corner, click via to the next page. You will be prompted for log in or sign up for an Oracle account. Skip this and find the link that says No thanks, just start my download. Now, right-click the link and select Copy Link Address (this option may be different, based on your browser).<\/p>\n<p>Now, you will be downloading the file. Move to a directory that you can write to on your server with the below command:<\/p>\n<pre class=\"lang:default decode:true \">$ cd \/tmp<\/pre>\n<p>Use <em>curl<\/em> to download the file and paste the address you just copied in place of the highlighted portion below:<\/p>\n<div class=\"code-font kb-box-focus\">$ curl -0L  <span style=\"color: red;\">https:\/\/dev.mysql.com\/get\/mysql-apt-config_0.8.10-1_all.deb<\/span><\/div>\n<p>It is important to pass two command line flags to <em>curl<\/em>. <em>-0<\/em> asks <em>curl<\/em> to output to a file rather than the standard output.<\/p>\n<p>The <em>L<\/em> flag helps <em>curl<\/em> follow HTTP redirects, which is essential in this case as the address you copied actually redirects you to another location prior to the file downloads.<\/p>\n<p>With this, the file should be downloaded in your current directory. For ensuring, list the files:<\/p>\n<pre class=\"lang:default decode:true \">$ 1s<\/pre>\n<p>You will see the filename listed:<\/p>\n<pre class=\"lang:default decode:true \">Output\r\nmysql-apt-config_0.8.10-1_all.deb\r\n. . .<\/pre>\n<p>Now you ready to install:<\/p>\n<pre class=\"lang:default decode:true \">$ sudo dpkg -i mysql-apt-config*<\/pre>\n<p>With <em>dpkg<\/em> you can install, remove, and inspect <em>.deb<\/em> software packages. The <em>-i<\/em> flag signifies that you would install from the specified file.<\/p>\n<p>While the installation continues, you will get a configuration screen displayed where you need to enter the version of MySQL of your choice in addition to an option for installing repositories for other MySQL-related tools. The repository information for the latest stable version of MySQL will be added by the defaults. This is what is expected so, use the down arrow to navigate to the <em>OK<\/em> menu option and hit <em>ENTER<\/em>.<\/p>\n<p>Now, the package will finish adding the repository. To make the new software packages available, refresh your apt package cache:<\/p>\n<pre class=\"lang:default decode:true \">$ sudo apt update<\/pre>\n<p>Also, it is important to clean up and delete the file that you downloaded:<\/p>\n<pre class=\"lang:default decode:true \">$ rm mysql-apt-config*<\/pre>\n<p>Now, you have added the MySQL repositories and so, you are ready to install the actual MySQL server software. In case, you need to update the configuration of these repositories, simply run <em>sudo dpkg-reconfigure mysql-apt-config<\/em>, select new options, and then sudo apt update to refresh your package cache.<\/p>\n<h3>Step 2 \u2014 Installing MySQL<\/h3>\n<p>After adding the repository and with your package cache freshly updated, you can now use apt to install the latest MySQL server package:<\/p>\n<pre class=\"lang:default decode:true \">$ sudo apt install mysql-server<\/pre>\n<p>All available <em>mysql-server<\/em> packages will be looked at by <em>apt<\/em> and verified that the MySQL provided package is the newest and best candidate. After that the package dependencies will be calculated and you will be asked to approve the installation. Type <em>y<\/em> then press <em>ENTER<\/em>. The software will get installed.<\/p>\n<p>Then you will need to set a root password during the configuration phase of the installation. Make sure you select a secure password. After entering it twice, hit <em>ENTER<\/em>. You will be asked to configure an authentication plugin. The <strong>Use Strong Password Encryption<\/strong> is recommended to be default, so hit <em>ENTER<\/em> to select it. Now the installation process will continue until it gets completed.<\/p>\n<p>You will see MySQL is installed and running. To check it use <em>systemctl<\/em>:<\/p>\n<pre class=\"lang:default decode:true \">$ systemctl status mysql<\/pre>\n<p>The <em>Active: active (running)<\/em> line indicates MySQL is installed and running. Now you will need to make the installation a little more secure.<\/p>\n<h3>Step 3 \u2014 Securing MySQL<\/h3>\n<p>A command is included in MySQL that you can use for performing a few security related updates on your new install.<\/p>\n<p>Run it now with the below command:<\/p>\n<pre class=\"lang:default decode:true \">$ mysql_secure_installation<\/pre>\n<p>Now you will be asked for the MySQL <strong>root<\/strong> password that you set while the installation. Type it and press ENTER. Now you will need to answer a series of yes or no prompts. Go through them:<\/p>\n<p>First, you will be asked about the <strong>validate password plugin<\/strong>, a plugin that can automatically implement certain password strength rules for your MySQL users. When you enable this, it is a decision you&#8217;ll need to make depending on your individual security needs. To enable it, type <em>y<\/em> and <em>ENTER<\/em> or simply hit <em>ENTER<\/em> to skip it. If you enable it, you will also be asked to select a level from 0\u20132 for the amount of strictness of the password validation. Select a number and press <em>ENTER<\/em> to continue.<\/p>\n<p>Next you&#8217;ll be asked for changing the root password, if required. Since you have just created the password while installing the MySQL, you can skip this. Press <em>ENTER<\/em> to continue without changing the password.<\/p>\n<p>Answer<strong> \u2018yes\u2019<\/strong> to the rest of the prompts. Now, you will be prompted for removing the <strong>anonymous<\/strong> MySQL user, removing the <strong>test<\/strong> database, disallowing remote <strong>root<\/strong> login, and reloading privilege tables to make sure that the previous changes take effect. All these are a good idea. Type <em>y<\/em> and press <em>ENTER<\/em> for each.<\/p>\n<p>After all the prompts are answered, the script will exit. Your MySQL installation is reasonably secured now. It is important to test it again by running a client that connects to the server and returns some information.<\/p>\n<h3>Step 4 \u2013 Testing MySQL<\/h3>\n<p>A command line administrative client for MySQL is termed as <em>mysqladmin<\/em>. You can use it to connect to the server and output some version and status information:<\/p>\n<pre class=\"lang:default decode:true \">$ mysqladmin -u root -p version<\/pre>\n<p>The <em>-u root<\/em> portion indicates <em>mysqladmin<\/em> to log in as the MySQL root user, <em>-p<\/em> indicates the client to prompt for a password, and <em>version<\/em> is the actual command you want to run.<\/p>\n<p>With the output you will know the version of the MySQL server, its uptime, and some other status information:<\/p>\n<pre class=\"lang:default decode:true \">Output\r\nmysqladmin Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL)\r\nCopyright (c) 2000, 2018, Oracle and\/or its affiliates. All rights reserved.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\naffiliates. Other names may be trademarks of their respective\r\nowners.\r\n\r\nServer version 8.0.11\r\nProtocol version 10\r\nConnection Localhost via UNIX socket\r\nUNIX socket \/var\/run\/mysqld\/mysqld.sock\r\nUptime: 2 min 21 sec\r\n\r\nThreads: 2 Questions: 10 Slow queries: 0 Opens: 136 Flush tables: 2 Open tables: 112 Queries per second avg: 0.070\r\nIf you get the similar output, it means you have successfully installed the latest MySQL server and secured it.<\/pre>\n<h3>Conclusion<\/h3>\n<p>You have completed the basic installation of the MySQL\u2019s latest version that should work for various applications. If you have some advanced requirements, you may continue with some other configuration tasks:<\/p>\n<ul>\n<li>If you want a graphical interface for administering your MySQL server, phpMyAdmin is a popular web-based solution.<\/li>\n<li>Currently, your database can only access the applications that are running on the same server. Often you\u2019ll require separate database and application servers, for performance and storage reasons.<\/li>\n<li>The next common configuration is to change the directory where MySQL stores its data. If you want your data stored on a different storage device than the default directory, then only you will need to do this.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A prominent open source database management system, MySQL is used to store and recover data for a several popular applications. M means MySQL in the LAMP stack, a commonly used set of open source software that comprises of Linux, the Apache web server, and the PHP programming language other than MySQL. For using the newly [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[230],"tags":[205,471,621],"class_list":["post-7647","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-database","tag-mysql","tag-mysql-database","tag-ubuntu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Install the Latest MySQL on Ubuntu 18.04?<\/title>\n<meta name=\"description\" content=\"The article gives complete information about installing the latest MySQL on Ubuntu 18.04.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Install the Latest MySQL on Ubuntu 18.04?\" \/>\n<meta property=\"og:description\" content=\"The article gives complete information about installing the latest MySQL on Ubuntu 18.04.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-09T05:43:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-09T05:45:52+00:00\" \/>\n<meta name=\"author\" content=\"Pallavi Godse\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pallavi Godse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/\",\"name\":\"How To Install the Latest MySQL on Ubuntu 18.04?\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2020-06-09T05:43:24+00:00\",\"dateModified\":\"2020-06-09T05:45:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"description\":\"The article gives complete information about installing the latest MySQL on Ubuntu 18.04.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Install the Latest MySQL on Ubuntu 18.04?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\",\"name\":\"Pallavi Godse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"caption\":\"Pallavi Godse\"},\"description\":\"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Install the Latest MySQL on Ubuntu 18.04?","description":"The article gives complete information about installing the latest MySQL on Ubuntu 18.04.","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:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/","og_locale":"en_GB","og_type":"article","og_title":"How To Install the Latest MySQL on Ubuntu 18.04?","og_description":"The article gives complete information about installing the latest MySQL on Ubuntu 18.04.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2020-06-09T05:43:24+00:00","article_modified_time":"2020-06-09T05:45:52+00:00","author":"Pallavi Godse","twitter_misc":{"Written by":"Pallavi Godse","Estimated reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/","name":"How To Install the Latest MySQL on Ubuntu 18.04?","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2020-06-09T05:43:24+00:00","dateModified":"2020-06-09T05:45:52+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"description":"The article gives complete information about installing the latest MySQL on Ubuntu 18.04.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-the-latest-mysql-on-ubuntu-18-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How To Install the Latest MySQL on Ubuntu 18.04?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945","name":"Pallavi Godse","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","caption":"Pallavi Godse"},"description":"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/"}]}},"views":501,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=7647"}],"version-history":[{"count":1,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7647\/revisions"}],"predecessor-version":[{"id":7648,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7647\/revisions\/7648"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=7647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=7647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=7647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}