{"id":39684,"date":"2021-12-06T12:30:00","date_gmt":"2021-12-06T18:30:00","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=39684"},"modified":"2022-06-03T03:31:28","modified_gmt":"2022-06-03T08:31:28","slug":"how-to-install-and-use-mysql-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/","title":{"rendered":"How to Install and Use MySQL on Ubuntu 20.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"742\" height=\"372\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg\" alt=\"How to Install and Use MySQL on Ubuntu 20.04\" class=\"wp-image-39802\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04-300x150.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04-150x75.jpg 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p>In this tutorial, we are going to show you how to install <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting.html\">MySQL on your Ubuntu 20.04<\/a> and how to use it with the basic MySQL commands. MySQL is an open-source relational database management system and with its popularity is used widely on different systems for storing data.<\/p>\n\n\n\n<p>In this post you will learn more about logging to MySQL with or without root user, database creation, user creation, granting privileges, external access to your databases, importing a database, making a dump of a database and etc. Let&#8217;s get started!<\/p>\n\n\n\n<!--more-->\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69cbaef6c4111\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69cbaef6c4111\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#1-Update-the-system\" >1. Update the system<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#2-Install-MySQL-server\" >2. Install MySQL server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#3-Secure-the-MySQL-server\" >3. Secure the MySQL server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#4-Login-to-MySQL-server-with-and-without-root-password\" >4. Login to MySQL server with and without root password<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#5-Database-User-creation-and-Granting-Privileges\" >5. Database, User creation and Granting Privileges<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#6-External-access-to-User\" >6. External access to User<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#7-Make-a-dump-of-database\" >7. Make a dump of database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#8-Import-database-dump\" >8. Import database dump<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-update-the-system\"><span class=\"ez-toc-section\" id=\"1-Update-the-system\"><\/span>1. Update the system<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We assume that you have a fresh installation of Ubuntu 20.04 as OS and that is why we are going to update the system before we start with the installation.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update -y &amp;&amp; sudo apt upgrade -y<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-install-mysql-server\"><span class=\"ez-toc-section\" id=\"2-Install-MySQL-server\"><\/span>2. Install MySQL server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Install the MySQL database server with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install mysql-server -y<\/pre>\n\n\n\n<p>After this command is executed the installation process of MySQL 8.0 will start. The MySQL 8.0 is included by default in the Ubuntu 20.04 repository. Once the installation is completed you can check if the service is up and running:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl status mysql<\/pre>\n\n\n\n<p>You should get the following output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@vps:~# systemctl status mysql\n\u25cf mysql.service - MySQL Community Server\n     Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\n     Active: active (running) since Thu 2021-11-04 17:07:12 UTC; 39s ago\n   Main PID: 98088 (mysqld)\n     Status: \"Server is operational\"\n      Tasks: 38 (limit: 4617)\n     Memory: 355.4M\n     CGroup: \/system.slice\/mysql.service\n             \u2514\u250098088 \/usr\/sbin\/mysqld<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-secure-the-mysql-server\"><span class=\"ez-toc-section\" id=\"3-Secure-the-MySQL-server\"><\/span>3. Secure the MySQL server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before we start using MySQL, we need to secure it with multiple steps with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mysql_secure_installation<\/pre>\n\n\n\n<p>This command will take us through multiple steps which will help us to configure the security of our MySQL, set a strong root password and, etc. You should use the options with bold letters from the output below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@vps:~# sudo mysql_secure_installation\n\nSecuring the MySQL server deployment.\n\nConnecting to MySQL using a blank password.\n\nVALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No: <b> Y <\/b>\n\nThere are three levels of password validation policy:\n\nLOW    Length &gt;= 8\nMEDIUM Length &gt;= 8, numeric, mixed case, and special characters\nSTRONG Length &gt;= 8, numeric, mixed case, special characters and dictionary                  file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: <b>2<\/b>\nPlease set the password for root here.\n\nNew password: <b>YourStrongRootPassword<\/b>\n\nRe-enter new password:<b>YourStrongRootPassword<\/b>\n\nEstimated strength of the password: 100\nDo you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : <b>Y<\/b>\nBy default, a MySQL installation has an anonymous user,\nallowing anyone to log into MySQL without having to have\na user account created for them. This is intended only for\ntesting, and to make the installation go a bit smoother.\nYou should remove them before moving into a production\nenvironment.\n\nRemove anonymous users? (Press y|Y for Yes, any other key for No) : <b>Y<\/b>\nSuccess.\n\n\nNormally, root should only be allowed to connect from\n'localhost'. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : <b>Y<\/b>\nSuccess.\n\nBy default, MySQL comes with a database named 'test' that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : <b>Y<\/b>\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : <b>Y<\/b>\nSuccess.\n\nAll done!<\/pre>\n\n\n\n<p>The MySQL installation will be secured now and we can proceed with some useful commands in the next steps<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-login-to-mysql-server-with-and-without-root-password\"><span class=\"ez-toc-section\" id=\"4-Login-to-MySQL-server-with-and-without-root-password\"><\/span>4. Login to MySQL server with and without root password<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>After fresh installation of MySQL, you can log in to MySQL prompt by only typing the &#8220;<b>mysql<\/b>&#8221; command on the servers command line without MySQL to ask the root password that you set up in the previous step.<\/p>\n\n\n\n<p>After typing the &#8220;<b>mysql<\/b>&#8221; you will be logged in the MySQL prompt.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@vps:~# mysql\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 13\nServer version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)\n\nCopyright (c) 2000, 2021, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql&gt;<\/pre>\n\n\n\n<p>The same will be if you execute the following command and hit enter without typing your password:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u root -p<\/pre>\n\n\n\n<p>To configure the MySQL to ask for root password execute the following command in the MySQL prompt:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourStrongRootPassword';<\/pre>\n\n\n\n<p>You should see the following input after executing<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourStrongRootPassword';\nQuery OK, 1 rows affected (0.01 sec)\n\nmysql<\/pre>\n\n\n\n<p>Now, if you try to login with &#8220;<b>mysql<\/b>&#8221; command you will get the message below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@vps:~# mysql\nERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/pre>\n\n\n\n<p>You need to use the command below, with your previously set root password:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u root -p<\/pre>\n\n\n\n<p>It is your choice to decide if you want to use a password for root login or not. If you want to access without the password simply ignore this step and move on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-5-database-user-creation-and-granting-privileges\"><span class=\"ez-toc-section\" id=\"5-Database-User-creation-and-Granting-Privileges\"><\/span>5. Database, User creation and Granting Privileges<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you list the databases in the MySQL prompt with command &#8220;show databases&#8221; you will get the default databases from MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; <b>show databases;<\/b>\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| mysql              |\n| performance_schema |\n| sys                |\n+--------------------+\n4 rows in set (0.01 sec)<\/pre>\n\n\n\n<p>To create a database, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Create database 'admin';<\/pre>\n\n\n\n<p>Once, it is created you can list again the databases:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| admin              |\n| information_schema |\n| mysql              |\n| performance_schema |\n| sys                |\n+--------------------+\n5 rows in set (0.00 sec)\n\nmysql&gt;\n<\/pre>\n\n\n\n<p>Let&#8217;s create a user named &#8220;adminuser&#8221; and grant privileges to the &#8220;admin&#8221; database with a password.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE USER 'adminuser'@'localhost' IDENTIFIED by 'YourStrongPassword';\n GRANT ALL PRIVILEGES ON admin* TO 'adminuser'@'localhost';\n FLUSH PRIVILEGES;\n EXIT;\n<\/pre>\n\n\n\n<p>Once, the database user is created with privileges to the &#8220;<b>admin<\/b>&#8221; database you can easily check if everything is set up correctly:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u adminuser -p<\/pre>\n\n\n\n<p>You should see only the &#8220;<b>admin<\/b>&#8221; and the default &#8220;<b>information_schema<\/b>&#8221; databases:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| admin              |\n| information_schema |\n+--------------------+\n2 rows in set (0.01 sec)\n\nmysql&gt;\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-6-external-access-to-user\"><span class=\"ez-toc-section\" id=\"6-External-access-to-User\"><\/span>6. External access to User<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To grant remote access to the user &#8220;<b>adminuser<\/b>&#8221; and our existing &#8220;<b>admin<\/b>&#8221; database execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GRANT ALL ON admin.* TO adminuser@'<b>remote_ip_address<\/b>' IDENTIFIED BY '<b>YourStrongPassword<\/b>';<\/pre>\n\n\n\n<p>If you want the user to connect from any IP address use the <b>%<\/b>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GRANT ALL ON admin.* TO adminuser@'<b>%<\/b>' IDENTIFIED BY 'YourStrongPassword';<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-7-make-a-dump-of-database\"><span class=\"ez-toc-section\" id=\"7-Make-a-dump-of-database\"><\/span>7. Make a dump of database<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Making a dump of the database does not need login to MySQL prompt. It can be done through the server command line terminal using the name of the user, database, and password. We will make a dump of our &#8220;<b>admin<\/b> database with the root user:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysqldump -u root -p admin &gt; dump.sql<\/pre>\n\n\n\n<p>Once the dump is completed you can list to check if everything is ok<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@vps:\/# mysqldump -u root -p admin &gt; dump.sql\nEnter password:\nroot@vps:\/# ls -al\ntotal 12\ndrwxr-xr-x  2 root root 4096 Nov  4 21:38 .\ndrwxr-xr-x 19 root root 4096 Oct 18 14:09 ..\n-rw-r--r--  1 root root 1266 Nov  4 21:40 dump.sql<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-8-import-database-dump\"><span class=\"ez-toc-section\" id=\"8-Import-database-dump\"><\/span>8. Import database dump<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To import the dump of the database into the &#8220;<b>admin<\/b>&#8221; database with the root user you need to use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u root -p admin &lt; dump.sql<\/pre>\n\n\n\n<p>This is the syntax for dumping and importing the database:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysqldump -u \"<b>database user<\/b>\" -p \"<b>database name<\/b>\" &gt; \"<b>name of dump file<\/b>\".sql\n\nmysql -u \"<b>database user<\/b>\" -p \"<b>database name<\/b>\" &lt; \"<b>name of dumped database<\/b>\".sql<\/pre>\n\n\n\n<p>Please note, the database user must have privileges to the database that need to be dumped. The MySQL root user has privileges to dump and import all databases.<\/p>\n\n\n\n<p>Congratulations, you managed to install and use the most important commands in the MySQL server<\/p>\n\n\n\n<p>If you want to learn more MySQL commands feel free to visit their official documentation. Of course, if you find it difficult you can contact our 24\/7 technical support, and our admins will <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting.html\">install and configure the MySQL server on Ubuntu 20.04 <\/a>for you.<\/p>\n\n\n\n<p>If you liked this post on how to install and use MySQL on Ubuntu 20.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we are going to show you how to install MySQL on your Ubuntu 20.04 and how to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Install and Use MySQL on Ubuntu 20.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#more-39684\" aria-label=\"Read more about How to Install and Use MySQL on Ubuntu 20.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":39802,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1698],"tags":[172,39,1839],"class_list":["post-39684","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-ubuntu","tag-install","tag-mysql","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Install and Use MySQL on Ubuntu 20.04 | RoseHosting<\/title>\n<meta name=\"description\" content=\"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.\" \/>\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.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install and Use MySQL on Ubuntu 20.04\" \/>\n<meta property=\"og:description\" content=\"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-06T18:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:31:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg?v=1637850761\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. 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\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Install and Use MySQL on Ubuntu 20.04\",\"datePublished\":\"2021-12-06T18:30:00+00:00\",\"dateModified\":\"2022-06-03T08:31:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\"},\"wordCount\":775,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg\",\"keywords\":[\"install\",\"mysql\",\"Ubuntu 20.04\"],\"articleSection\":[\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\",\"name\":\"How to Install and Use MySQL on Ubuntu 20.04 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg\",\"datePublished\":\"2021-12-06T18:30:00+00:00\",\"dateModified\":\"2022-06-03T08:31:28+00:00\",\"description\":\"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg\",\"width\":742,\"height\":372,\"caption\":\"How to Install and Use MySQL on Ubuntu 20.04\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install and Use MySQL on Ubuntu 20.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Install and Use MySQL on Ubuntu 20.04 | RoseHosting","description":"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.","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.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Install and Use MySQL on Ubuntu 20.04","og_description":"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2021-12-06T18:30:00+00:00","article_modified_time":"2022-06-03T08:31:28+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg?v=1637850761","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_description":"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Install and Use MySQL on Ubuntu 20.04","datePublished":"2021-12-06T18:30:00+00:00","dateModified":"2022-06-03T08:31:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/"},"wordCount":775,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg","keywords":["install","mysql","Ubuntu 20.04"],"articleSection":["Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/","name":"How to Install and Use MySQL on Ubuntu 20.04 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg","datePublished":"2021-12-06T18:30:00+00:00","dateModified":"2022-06-03T08:31:28+00:00","description":"Want to learn how to install MySQL on your Ubuntu 20.04 and how to use it with the basic MySQL commands? Check out our tutorial.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/11\/how-to-install-and-use-mysql-on-ubuntu-20.04.jpg","width":742,"height":372,"caption":"How to Install and Use MySQL on Ubuntu 20.04"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-use-mysql-on-ubuntu-20-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install and Use MySQL on Ubuntu 20.04"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/39684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=39684"}],"version-history":[{"count":25,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/39684\/revisions"}],"predecessor-version":[{"id":39824,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/39684\/revisions\/39824"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/39802"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=39684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=39684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=39684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}