{"id":283,"date":"2016-05-02T16:29:02","date_gmt":"2016-05-02T16:29:02","guid":{"rendered":"http:\/\/www.copahost.com\/blog\/?p=283"},"modified":"2020-05-31T14:22:23","modified_gmt":"2020-05-31T14:22:23","slug":"install-mysql-ubuntu-14","status":"publish","type":"post","link":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/","title":{"rendered":"How to install MySQL in Ubuntu 14"},"content":{"rendered":"<p>To install MySQL in Ubuntu, need to have root access to an Ubuntu server. This tutorial applies either to a <a href=\"https:\/\/www.copahost.com\/en\/dedicated-servers\">dedicated server<\/a> and a cheap <a href=\"https:\/\/www.copahost.com\/en\/cheap-vps-hosting\">vps hosting server<\/a>. The first step is to login by SSH into your server.<\/p>\n<p>First of all, we have to update all the packages of the server<\/p>\n<pre class=\"lang:default decode:true\">sudo apt-get update\r\nsudo apt-get upgrade<\/pre>\n<h3>Now we will install MySQL in Ubuntu<\/h3>\n<pre class=\"lang:default decode:true\">sudo apt-get install mysql-server<\/pre>\n<p>During the MySQL installation uou will be prompted for the MySQL root password. Write it down and keep it in a safe place.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-284\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg\" alt=\"install mysql in ubuntu 1\" width=\"641\" height=\"384\" \/><\/p>\n<p>If you forget the MySQL root password, you can read this article: <a href=\"https:\/\/www.copahost.com\/blog\/reset-mysql-root-password-ubuntu\/\">how to recover MySQL root password in Ubuntu<\/a><\/p>\n<p>Now that the installation is completed, MySQL will start listening only for internal connections in <strong>localhost<\/strong> on port 3306. As you <a href=\"https:\/\/www.copahost.com\/blog\/install-apache-in-ubuntu-14\/\" >install mysql in ubuntu<\/a>, the remote connections will be blocked.<\/p>\n<h3>Managing the MySQL server<\/h3>\n<p>Having the installation completed, we can now <a href=\"https:\/\/www.copahost.com\/blog\/login-registration-php-mysql-bootstrap\/\" >login to the MySQL<\/a> server:<\/p>\n<pre class=\"lang:default decode:true\">mysql -u root -p<\/pre>\n<p>You will see this output:<\/p>\n<pre class=\"lang:default decode:true\">root@teste2:\/# mysql -u root -p\r\nEnter password:\r\nWelcome to the MySQL monitor. Commands end with ; or \\g.\r\nYour MySQL connection id is 42\r\nServer version: 5.5.49-0ubuntu0.14.04.1 (Ubuntu)\r\n\r\nCopyright (c) 2000, 2016, 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\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nmysql&gt;<\/pre>\n<h3>Managing the installed MySQL server<\/h3>\n<p>First, we will create a new database.<\/p>\n<pre class=\"\">create database mydb;<\/pre>\n<p>Now we will create a new user. You must replace <strong>[password]<\/strong>\u00a0with the desired password for it.<\/p>\n<pre class=\"\">create user 'user1'@'localhost' identified by '[password]';<\/pre>\n<p>Give access <a href=\"https:\/\/www.copahost.com\/blog\/mysql-grant-all-privileges-how-to-manage-user-privileges\/\" >privileges to the user<\/a> to the new database:<\/p>\n<pre class=\"\">grant all on mydb.* to 'user1';<\/pre>\n<p>Now exit mysql, and access with the newly created user:<\/p>\n<pre class=\"lang:default decode:true\">exit<\/pre>\n<p>To <a href=\"https:\/\/www.copahost.com\/blog\/list-mysql-users\/\" >access with the new user<\/a>, just issue the command:<\/p>\n<pre class=\"lang:default decode:true\">mysql -u user1 -p<\/pre>\n<h3>Creating a MySQL table<\/h3>\n<p>To create a new table in our recently created database, we must first\u00a0issue the command <strong>use &lt;database_name&gt;<\/strong> , and then, issue the <strong>Create table<\/strong> command:<\/p>\n<pre class=\"lang:default decode:true\">use mydb;\r\ncreate table clients (client_id INT NOT NULL, name TEXT NOT NULL ,phone TEXT NOT NULL);<\/pre>\n<p>Now the table is created.<\/p>\n<p>Some useful comands, are <strong>show tables<\/strong> and <strong>describe<\/strong>. Show tables will show you all the created tables in the server, and describe will show in details all the fields of a certain table.<\/p>\n<pre class=\"lang:default decode:true \">mysql&gt; show tables;\r\n+----------------+\r\n| Tables_in_mydb |\r\n+----------------+\r\n| clients        |\r\n+----------------+\r\n1 row in set (0.00 sec)<\/pre>\n<pre class=\"lang:default decode:true\">mysql&gt; describe clients;\r\n+-----------+---------+------+-----+---------+-------+\r\n| Field     | Type    | Null | Key | Default | Extra |\r\n+-----------+---------+------+-----+---------+-------+\r\n| client_id | int(11) | NO   |     | NULL    |       |\r\n| name      | text    | NO   |     | NULL    |       |\r\n| phone     | text    | NO   |     | NULL    |       |\r\n+-----------+---------+------+-----+---------+-------+\r\n3 rows in set (0.00 sec)<\/pre>\n<p>Keep in mind that by completing the <a href=\"https:\/\/www.copahost.com\/blog\/install-postgresql-ubuntu-14\/\" >install MySQL in ubuntu<\/a> task, it will block external connections. You can only connect to your database server from inside your server, unless you enable the remote connections.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To install MySQL in Ubuntu, need to have root access to an Ubuntu server. This tutorial applies either to a dedicated server and a cheap vps hosting server. The first step is to login by SSH into your server. First of all, we have to update all the packages of the server sudo apt-get update [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,91],"tags":[93,39,92],"class_list":["post-283","post","type-post","status-publish","format-standard","hentry","category-linux-tutorials","category-mysql","tag-install-mysql","tag-mysql","tag-ubuntu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to install MySQL in Ubuntu 14 - Copahost<\/title>\n<meta name=\"description\" content=\"Guide about how to install MySQL in Ubuntu 14. Includes the initial configuration, how to connect do MySQL, create a database and perform queries.\" \/>\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.copahost.com\/blog\/install-mysql-ubuntu-14\/\" \/>\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 in Ubuntu 14 - Copahost\" \/>\n<meta property=\"og:description\" content=\"Guide about how to install MySQL in Ubuntu 14. Includes the initial configuration, how to connect do MySQL, create a database and perform queries.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/\" \/>\n<meta property=\"og:site_name\" content=\"Copahost\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-02T16:29:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-31T14:22:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg\" \/>\n<meta name=\"author\" content=\"Gustavo Gallas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gustavo Gallas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/\"},\"author\":{\"name\":\"Gustavo Gallas\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\"},\"headline\":\"How to install MySQL in Ubuntu 14\",\"datePublished\":\"2016-05-02T16:29:02+00:00\",\"dateModified\":\"2020-05-31T14:22:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/\"},\"wordCount\":324,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg\",\"keywords\":[\"install mysql\",\"mysql\",\"ubuntu\"],\"articleSection\":[\"Linux tutorials\",\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/\",\"name\":\"How to install MySQL in Ubuntu 14 - Copahost\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg\",\"datePublished\":\"2016-05-02T16:29:02+00:00\",\"dateModified\":\"2020-05-31T14:22:23+00:00\",\"description\":\"Guide about how to install MySQL in Ubuntu 14. Includes the initial configuration, how to connect do MySQL, create a database and perform queries.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg\",\"width\":641,\"height\":384},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.copahost.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to install MySQL in Ubuntu 14\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"name\":\"Copahost\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.copahost.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\",\"name\":\"Copahost\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"width\":223,\"height\":40,\"caption\":\"Copahost\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246\",\"name\":\"Gustavo Gallas\",\"description\":\"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/\"],\"url\":\"https:\/\/www.copahost.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install MySQL in Ubuntu 14 - Copahost","description":"Guide about how to install MySQL in Ubuntu 14. Includes the initial configuration, how to connect do MySQL, create a database and perform queries.","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.copahost.com\/blog\/install-mysql-ubuntu-14\/","og_locale":"en_US","og_type":"article","og_title":"How to install MySQL in Ubuntu 14 - Copahost","og_description":"Guide about how to install MySQL in Ubuntu 14. Includes the initial configuration, how to connect do MySQL, create a database and perform queries.","og_url":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/","og_site_name":"Copahost","article_published_time":"2016-05-02T16:29:02+00:00","article_modified_time":"2020-05-31T14:22:23+00:00","og_image":[{"url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg"}],"author":"Gustavo Gallas","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Gustavo Gallas","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#article","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/"},"author":{"name":"Gustavo Gallas","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246"},"headline":"How to install MySQL in Ubuntu 14","datePublished":"2016-05-02T16:29:02+00:00","dateModified":"2020-05-31T14:22:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/"},"wordCount":324,"commentCount":0,"publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg","keywords":["install mysql","mysql","ubuntu"],"articleSection":["Linux tutorials","MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/","url":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/","name":"How to install MySQL in Ubuntu 14 - Copahost","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg","datePublished":"2016-05-02T16:29:02+00:00","dateModified":"2020-05-31T14:22:23+00:00","description":"Guide about how to install MySQL in Ubuntu 14. Includes the initial configuration, how to connect do MySQL, create a database and perform queries.","breadcrumb":{"@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#primaryimage","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/05\/install-mysql-in-ubuntu-1.jpg","width":641,"height":384},{"@type":"BreadcrumbList","@id":"https:\/\/www.copahost.com\/blog\/install-mysql-ubuntu-14\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.copahost.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to install MySQL in Ubuntu 14"}]},{"@type":"WebSite","@id":"https:\/\/www.copahost.com\/blog\/#website","url":"https:\/\/www.copahost.com\/blog\/","name":"Copahost","description":"","publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.copahost.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.copahost.com\/blog\/#organization","name":"Copahost","url":"https:\/\/www.copahost.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","width":223,"height":40,"caption":"Copahost"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/386b3f1f79299d43f4ceb33d26428246","name":"Gustavo Gallas","description":"Graduated in Computing at PUC-Rio, Brazil. Specialized in IT, networking, systems administration and human and organizational development\u200b. Also have brewing skills.","sameAs":["https:\/\/www.linkedin.com\/in\/gustavo-gallas-107926196\/"],"url":"https:\/\/www.copahost.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/comments?post=283"}],"version-history":[{"count":6,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/283\/revisions"}],"predecessor-version":[{"id":2562,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/283\/revisions\/2562"}],"wp:attachment":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media?parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/categories?post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/tags?post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}