{"id":2595,"date":"2019-06-14T13:14:20","date_gmt":"2019-06-14T07:44:20","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=2595"},"modified":"2021-05-17T19:28:22","modified_gmt":"2021-05-17T13:58:22","slug":"how-to-install-mysql-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/","title":{"rendered":"How to Install MySQL on Ubuntu 18.04"},"content":{"rendered":"\n<p>In this post, we will learn how to install MySQL on Ubuntu 18.04<\/p>\n\n\n\n<p> Before proceeding, the user must have sudo privileges using which you are logged in. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing MySQL<\/h2>\n\n\n\n<p>1) Run updates for indexing packages<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt update<\/pre>\n\n\n\n<p>2) Install MySQL package<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt install mysql-server<\/pre>\n\n\n\n<p>3) MySQL service will start automatically or run below command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl start mysql <\/pre>\n\n\n\n<p>Check MySQL service status <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo systemctl status mysql<\/pre>\n\n\n\n<p>Output would be like <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u25cf mysql.service - MySQL Community Server\n    Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\n    Active: active (running) since Wed 2019-06-15 1635 UTC; 2min ago\n  Main PID: 15745 (mysqld)\n     Tasks: 30 (limit: 548)\n    CGroup: \/system.slice\/mysql.service\n            `-15745 \/usr\/sbin\/mysqld --daemonize --pid-file=\/run\/mysqld\/mysqld.pid<\/pre>\n\n\n\n<p>After installation Secure MySQL using below steps <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo mysql_secure_installation<\/pre>\n\n\n\n<p>This command will prompt you for <strong>root password,remove anonymous users<\/strong>,&nbsp;<strong>disallow remote root login<\/strong>, and&nbsp;<strong>remove the test database and access<\/strong>&nbsp;to secure <strong>MySQL<\/strong> .<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\n\nIn order to log into MySQL to secure it, we'll need the current\npassword for the root user.  If you've just installed MySQL, and\nyou haven't set the root password yet, the password will be blank,\nso you should just press enter here.\n\nEnter current password for root (enter for none):\n\nOK, successfully used password, moving on...\n\nSetting the root password ensures that nobody can log into the MySQL\nroot user without the proper authorisation.\n\n<strong>Set root password? [Y\/n] Y<\/strong>\n\nNew password:\nRe-enter new password:\nPassword updated successfully!\nReloading privilege tables..\n ... Success!\n\n<strong>Remove anonymous users? [Y\/n] y<\/strong>\n ... Success!\n\nNormally, root should only be allowed to connect from 'localhost'.  This\nensures that someone cannot guess at the root password from the network.\n\n<strong>Disallow root login remotely? [Y\/n] y<\/strong>\n ... Success!\n\nBy default, MariaDB comes with a database named 'test' that anyone can\naccess.  This is also intended only for testing, and should be removed\nbefore moving into a production environment.\n\n<strong>Remove test database and access to it? [Y\/n] y<\/strong>\n - Dropping test database...\n ... Success!\n - Removing privileges on test database...\n ... Success!\n\nReloading the privilege tables will ensure that all changes made so far\nwill take effect immediately.\n\n<strong>Reload privilege tables now? [Y\/n] y<\/strong>\n ... Success!\n\nCleaning up...\n\nAll done!  If you've completed all of the above steps, your MariaDB\ninstallation should now be secure.\n\nThanks for using MySQL!<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we will learn how to install MySQL on Ubuntu 18.04 Before proceeding, the user must have sudo privileges using which you are logged in. Installing MySQL 1) Run updates for indexing packages $ sudo apt update 2) Install MySQL package $ sudo apt install mysql-server 3) MySQL service will start automatically or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[166],"tags":[25,83],"class_list":["post-2595","post","type-post","status-publish","format-standard","hentry","category-ubuntu","tag-mysql","tag-ubuntu"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install MySQL on Ubuntu 18.04 | 24x7serversupport Blog<\/title>\n<meta name=\"description\" content=\"How to install 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.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-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 MySQL on Ubuntu 18.04 | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"How to install MySQL on Ubuntu 18.04\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-14T07:44:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-17T13:58:22+00:00\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\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\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/\",\"name\":\"How to Install MySQL on Ubuntu 18.04 | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"datePublished\":\"2019-06-14T07:44:20+00:00\",\"dateModified\":\"2021-05-17T13:58:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"description\":\"How to install MySQL on Ubuntu 18.04\",\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install MySQL on Ubuntu 18.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install MySQL on Ubuntu 18.04 | 24x7serversupport Blog","description":"How to install 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.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Install MySQL on Ubuntu 18.04 | 24x7serversupport Blog","og_description":"How to install MySQL on Ubuntu 18.04","og_url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/","og_site_name":"24x7serversupport Blog","article_published_time":"2019-06-14T07:44:20+00:00","article_modified_time":"2021-05-17T13:58:22+00:00","author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/","url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/","name":"How to Install MySQL on Ubuntu 18.04 | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"datePublished":"2019-06-14T07:44:20+00:00","dateModified":"2021-05-17T13:58:22+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"description":"How to install MySQL on Ubuntu 18.04","breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mysql-on-ubuntu-18-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install MySQL on Ubuntu 18.04"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=2595"}],"version-history":[{"count":2,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2595\/revisions"}],"predecessor-version":[{"id":2601,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2595\/revisions\/2601"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=2595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=2595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=2595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}