{"id":11218,"date":"2023-11-04T16:35:43","date_gmt":"2023-11-04T16:35:43","guid":{"rendered":"https:\/\/gsmkingpin.com\/wp\/2023\/11\/04\/how-to-install-mysql-on-ubuntu\/"},"modified":"2023-11-04T16:35:43","modified_gmt":"2023-11-04T16:35:43","slug":"how-to-install-mysql-on-ubuntu","status":"publish","type":"post","link":"https:\/\/gsmkingpin.com\/wp\/2023\/11\/04\/how-to-install-mysql-on-ubuntu\/","title":{"rendered":"How to install MySQL on Ubuntu"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>There are a lot of development tools you can use on <a href=\"http:\/\/www.xda-developers.com\/ubuntu\/\">Ubuntu<\/a>, and one of them is MySQL. We&#8217;re sure you&#8217;re familiar with it, but MySQL is one of the most popular relational database management systems. It&#8217;s open source, and it sits behind other products like Oracle Database, which means MySQL also works on Ubuntu. To install it, you&#8217;ll just need to run a few commands in the terminal. We&#8217;re here to guide you through the process.<\/p>\n<p><!-- Repeatable debug data: {\"injection\":\"before\",\"adPosition\":0,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":0,\"nbrPlacementsScanned\":0,\"ruleCount\":10,\"degradationStartingPoint\":1,\"actualCount\":448} --><!-- Zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"after\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":0,\"ruleCount\":10,\"degradationStartingPoint\":1,\"actualCount\":0} --><br \/>\n<!-- No winning ad found for zone: below first paragraph! --><br \/>\n<!-- No winning ad found for zone: native in content! --><\/p>\n<h2 id=\"how-to-install-mysql-on-ubuntu\"> How to install MySQL on Ubuntu <\/h2>\n<p>Like with many other development and technical tasks on Linux, there&#8217;s something to keep in mind before you install MySQL on Ubuntu. You&#8217;ll need an account with administrative (sudo) privileges to access the terminal. You&#8217;ll also need a network connection. Once you pass these prerequisites, you can proceed with the steps below. Oh, and after every command, you&#8217;ll have to press the <strong>Enter <\/strong>key.<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":410} --><\/p>\n<ol>\n<li> Update your packages with the command:\n<pre><strong>sudo apt update<\/strong><\/pre>\n<\/li>\n<li> Enter your password.\n<div class=\"body-img landscape\">\n<div class=\"responsive-img image-expandable img-article-item\" style=\"padding-bottom:58.627087198516%\" data-img-url=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-23-11-51-02.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"null\">\n<figure> <picture><!--[if IE 9]> <video style=\"display: none;\"><![endif]--><source media=\"(min-width: 1024px)\" sizes=\"1500px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-23-11-51-02.png?q=50&amp;fit=crop&amp;w=1500&amp;dpr=1.5\"\/><source media=\"(min-width: 768px)\" sizes=\"943px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-23-11-51-02.png?q=50&amp;fit=crop&amp;w=943&amp;dpr=1.5\"\/><source media=\"(min-width: 481px)\" sizes=\"767px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-23-11-51-02.png?q=50&amp;fit=crop&amp;w=767&amp;dpr=1.5\"\/><source media=\"(min-width: 0px)\" sizes=\"480px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-23-11-51-02.png?q=50&amp;fit=crop&amp;w=480&amp;dpr=1.5\"\/><!--[if IE 9]><\/video><![endif]--><img loading=\"lazy\" decoding=\"async\" width=\"1078\" class=\"lazyload\" height=\"632\" alt=\"Installing Git on Ubuntu\" style=\"display:block;height:auto;max-width:100%;\" src=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-23-11-51-02.png\"\/> <\/picture> <\/figure>\n<\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li> Upgrade your packages with the command:\n<pre><strong>sudo apt upgrade<\/strong><\/pre>\n<\/li>\n<li> If prompted, press <strong>Y <\/strong>and then <strong>Enter.<\/strong> <\/li>\n<li> With packages upgraded, install MySQL with the command:\n<pre><strong>sudo apt install mysql-server<\/strong><\/pre>\n<div class=\"body-img landscape\">\n<div class=\"responsive-img image-expandable img-article-item\" style=\"padding-bottom:64.973262032086%\" data-img-url=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-25-11-57-08.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"null\">\n<figure> <picture><!--[if IE 9]> <video style=\"display: none;\"><![endif]--><source media=\"(min-width: 1024px)\" sizes=\"1500px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-25-11-57-08.png?q=50&amp;fit=crop&amp;w=1500&amp;dpr=1.5\"\/><source media=\"(min-width: 768px)\" sizes=\"943px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-25-11-57-08.png?q=50&amp;fit=crop&amp;w=943&amp;dpr=1.5\"\/><source media=\"(min-width: 481px)\" sizes=\"767px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-25-11-57-08.png?q=50&amp;fit=crop&amp;w=767&amp;dpr=1.5\"\/><source media=\"(min-width: 0px)\" sizes=\"480px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-25-11-57-08.png?q=50&amp;fit=crop&amp;w=480&amp;dpr=1.5\"\/><!--[if IE 9]><\/video><![endif]--><img loading=\"lazy\" decoding=\"async\" width=\"1496\" class=\"lazyload\" height=\"972\" alt=\"installing mysql server on Ubuntu\" style=\"display:block;height:auto;max-width:100%;\" src=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-25-11-57-08.png\"\/> <\/picture> <\/figure>\n<\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li> If prompted, enter your password, press <strong>Y <\/strong>and then <strong>Enter.<\/strong> <\/li>\n<li> You can then log in to MySQL Server by running the command:\n<pre><strong>sudo mysql -u root<\/strong><\/pre>\n<p> Or, simply start MySQL with <\/p>\n<pre><strong>sudo systemctl start mysql.<\/strong><\/pre>\n<\/li>\n<\/ol>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":894} --><\/p>\n<p>MySQL will be installed on your machine. It could take a while, depending on your internet speed. When complete, you can check for it with the command<strong> mysql &#8211;version.<\/strong> At any time, you can check to see if MySQL is running by entering the command:<\/p>\n<p><!-- Repeatable debug data: {\"injection\":\"before\",\"adPosition\":1,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":1,\"nbrPlacementsScanned\":1,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":1140} --><!-- Zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"after\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":1,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":0} --><\/p>\n<pre><strong>sudo systemctl status MySQL<\/strong><\/pre>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":27} --><\/p>\n<pre>\n<!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":27} -->\n<\/pre>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":27} --><\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":27} --><\/p>\n<h2 id=\"additional-steps-for-mysql-configuration\"> Additional steps for MySQL configuration <\/h2>\n<p>Those were just the basic steps for setting up MySQL on Ubuntu. After installation, there are a few other things we suggest doing.<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":157} --><\/p>\n<h3 id=\"secure-your-mysql-session\">Secure your MySQL session<\/h3>\n<p>By default, you won&#8217;t get a password, but you can type the command:<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":228} --><\/p>\n<pre><strong>sudo mysql_secure_installation<\/strong><\/pre>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":258} --><\/p>\n<p>From there, you can enter your password, press <strong>Y <\/strong>to confirm, follow the steps on your screen, and choose a password level.<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":380} --><\/p>\n<h3 id=\"allow-remote-access\">Allow remote access<\/h3>\n<p>You can enable remote access to connect to your databases from another machine. Type the following commands:<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":488} --><\/p>\n<pre><strong>sudo ufw enable\n<!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":503} -->\n<\/strong><strong>sudo ufw allow mysql<\/strong><\/pre>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":523} --><\/p>\n<div class=\"body-img landscape\">\n<div class=\"responsive-img image-expandable img-article-item\" style=\"padding-bottom:66.791393826006%\" data-img-url=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-30-14-30-15.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"null\">\n<figure> <picture><!--[if IE 9]> <video style=\"display: none;\"><![endif]--><source media=\"(min-width: 1024px)\" sizes=\"1500px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-30-14-30-15.png?q=50&amp;fit=crop&amp;w=1500&amp;dpr=1.5\"\/><source media=\"(min-width: 768px)\" sizes=\"943px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-30-14-30-15.png?q=50&amp;fit=crop&amp;w=943&amp;dpr=1.5\"\/><source media=\"(min-width: 481px)\" sizes=\"767px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-30-14-30-15.png?q=50&amp;fit=crop&amp;w=767&amp;dpr=1.5\"\/><source media=\"(min-width: 0px)\" sizes=\"480px\" data-srcset=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-30-14-30-15.png?q=50&amp;fit=crop&amp;w=480&amp;dpr=1.5\"\/><!--[if IE 9]><\/video><![endif]--><img loading=\"lazy\" decoding=\"async\" width=\"1069\" class=\"lazyload\" height=\"714\" alt=\"Allowing MySQL through the firewall on Ubuntu\" style=\"display:block;height:auto;max-width:100%;\" src=\"https:\/\/static1.xdaimages.com\/wordpress\/wp-content\/uploads\/wm\/2023\/10\/screenshot-from-2023-10-30-14-30-15.png\"\/> <\/picture> <\/figure>\n<\/p><\/div>\n<\/p><\/div>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":763} --><\/p>\n<h3 id=\"launch-mysql-at-reboot\">Launch MySQL at reboot<\/h3>\n<p>If you always want your server to run each time you reboot your system, run the command:<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":851} --><\/p>\n<pre><strong>sudo systemctl enable mysql<\/strong><\/pre>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":878} --><\/p>\n<h3 id=\"see-users\">See users<\/h3>\n<p>To see all users on a database, type the following command:<\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":937} --><\/p>\n<pre><strong>SELECT User, Host, authentication_string FROM mysql.user;<\/strong><\/pre>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":994} --><\/p>\n<p>We hope you found this guide helpful. If you&#8217;re a developer using Ubuntu, you might also be interested in checking out our list of some of the <a href=\"https:\/\/www.xda-developers.com\/best-laptops\">best laptops<\/a> and <a href=\"https:\/\/www.xda-developers.com\/best-desktop-computers\/\">desktops<\/a>, including ones that <a href=\"https:\/\/www.xda-developers.com\/best-laptops-linux\/\">work well with Linux<\/a>. Having the right hardware can always make your life easier. <\/p>\n<p><!-- Repeatable debug data: {\"injection\":\"before\",\"adPosition\":2,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":2,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":1270} --><!-- Zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"after\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":2,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":0} --><\/p>\n<p><!-- No repeatable ad for zone: character count repeatable. --><!-- Repeatable debug data: {\"injection\":\"none\",\"adPosition\":3,\"startingPoint\":0,\"skipEvery\":null,\"nbrPlacementFilledEachSkip\":3,\"nbrPlacementsScanned\":3,\"ruleCount\":1000,\"degradationStartingPoint\":1,\"actualCount\":1} --><\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/www.xda-developers.com\/how-install-mysql-ubuntu\/\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are a lot of development tools you can use on Ubuntu, and one of them is MySQL. We&#8217;re sure you&#8217;re familiar with it, but MySQL is one of the most popular relational database management systems. It&#8217;s open source, and it sits behind other products like Oracle Database, which means MySQL also works on Ubuntu.&hellip; <a class=\"more-link\" href=\"https:\/\/gsmkingpin.com\/wp\/2023\/11\/04\/how-to-install-mysql-on-ubuntu\/\">Continue reading <span class=\"screen-reader-text\">How to install MySQL on Ubuntu<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":10565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/posts\/11218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/comments?post=11218"}],"version-history":[{"count":0,"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/posts\/11218\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/media\/10565"}],"wp:attachment":[{"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/media?parent=11218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/categories?post=11218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gsmkingpin.com\/wp\/wp-json\/wp\/v2\/tags?post=11218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}