{"id":2665,"date":"2013-04-25T16:38:24","date_gmt":"2013-04-25T16:38:24","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2013\/04\/25\/mysql-command-line\/"},"modified":"2021-08-16T23:15:01","modified_gmt":"2021-08-17T03:15:01","slug":"mysql-command-line","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/","title":{"rendered":"How to Access MySQL via Command Line"},"content":{"rendered":"<p>MySQL is the actual database system that uses the Structured Query Language to process data. MySQL is currently the most popular open source database and is frequently utilized with PHP to create dynamic websites. That said, MySQL also works well with Python, Ruby and Perl. This article will guide you on how to <strong>access the MySQL tool via command line<\/strong>.<\/p>\n<div style=\"background-color: #fafad2; border: 1px #D3D3D3 dashed; border-radius: 5px; padding: 0px 0px 0px 5px;\">Note that you can only access MySQL via Shell, or command line, via a VPS or Dedicated server account. This is not a feature that is available on shared accounts.<\/div>\n<h2>Accessing MySQL via command line<\/h2>\n<ol class=\"article_list\">\n<li>Log into your server via ssh.\n<div style=\"clear:both;\"><\/div>\n<\/li>\n<li>Once in your shell, you will at the command line prompt. To log into the MySQL monitor, use the following syntax:<br \/> \n<div class=\"code_block\"><em>mysql -u <db-username> -p<\/db-username><\/em><\/div>\n<\/li>\n<\/ol>\n<p>The <em><db-username><\/db-username><\/em> tag will need to be replaced with the actual database username with which you want to sign into the monitor. If you do not know which user you want to use, you can <a href=\"\/support\/website\/find-database-users\/\">find a list of users for your databases<\/a> via your cPanel.<\/p>\n<div style=\"clear:both;\"><\/div>\n<li>Once you have your database user name, enter command line code similar to below and hit <em>Enter<\/em>. In our case, we are using a database user named <em>inmoti5_dbuser1<\/em>.\n<div class=\"cli\">root@vps9999 [~]# mysql -u inmoti5_dbuser1 -p<\/p>\n<div style=\"clear:both;\"><\/div>\n<\/div>\n<\/li>\n<li>Due to the <em>-p<\/em> switch with nothing following, you will be required to enter your password as below. Simply enter the password and click <em>Enter<\/em>.\n<div class=\"cli\">Enter password:<\/div>\n<div style=\"clear:both;\"><\/div>\n<\/li>\n<li>After entering the correct password you will be met with the following greeting and MySQL prompt:\n<div class=\"cli\"> Welcome to the MySQL monitor.  Commands end with ; or g.<br \/> Your MySQL connection id is 19472<br \/> Server version: 5.5.30-cll MySQL Community Server (GPL)<\/p>\n<p>  Copyright (c) 2000, 2013, Oracle and\/or its affiliates. All rights reserved.<\/p>\n<p>  Oracle is a registered trademark of Oracle Corporation and\/or its<br \/> affiliates. Other names may be trademarks of their respective<br \/> owners.<\/p>\n<p>  Type &#8216;help;&#8217; or &#8216;h&#8217; for help. Type &#8216;c&#8217; to clear the current input statement.<\/p>\n<p>  mysql&gt;<\/p><\/div>\n<div style=\"clear:both;\"><\/div>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>MySQL is the actual database system that uses the Structured Query Language to process data. MySQL is currently the most popular open source database and is frequently utilized with PHP to create dynamic websites. That said, MySQL also works well with Python, Ruby and Perl. This article will guide you on how to access the<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\"> Read More ><\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4308,4305],"tags":[],"class_list":["post-2665","post","type-post","status-publish","format-standard","hentry","category-linux","category-databases"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Access MySQL via Command Line | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to access and use MySQL via command line.\" \/>\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.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Access MySQL via Command Line | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to access and use MySQL via command line.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-25T16:38:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-17T03:15:01+00:00\" \/>\n<meta name=\"author\" content=\"Scott Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Scott Mitchell\" \/>\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\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\"},\"author\":{\"name\":\"Scott Mitchell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\"},\"headline\":\"How to Access MySQL via Command Line\",\"datePublished\":\"2013-04-25T16:38:24+00:00\",\"dateModified\":\"2021-08-17T03:15:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\"},\"wordCount\":325,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Linux\",\"Working with Databases\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\",\"name\":\"How to Access MySQL via Command Line | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2013-04-25T16:38:24+00:00\",\"dateModified\":\"2021-08-17T03:15:01+00:00\",\"description\":\"Learn how to access and use MySQL via command line.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Access MySQL via Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\",\"name\":\"Scott Mitchell\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Access MySQL via Command Line | InMotion Hosting","description":"Learn how to access and use MySQL via command line.","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.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/","og_locale":"en_US","og_type":"article","og_title":"How to Access MySQL via Command Line | InMotion Hosting","og_description":"Learn how to access and use MySQL via command line.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2013-04-25T16:38:24+00:00","article_modified_time":"2021-08-17T03:15:01+00:00","author":"Scott Mitchell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Scott Mitchell","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/"},"author":{"name":"Scott Mitchell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed"},"headline":"How to Access MySQL via Command Line","datePublished":"2013-04-25T16:38:24+00:00","dateModified":"2021-08-17T03:15:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/"},"wordCount":325,"commentCount":1,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Linux","Working with Databases"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/","name":"How to Access MySQL via Command Line | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2013-04-25T16:38:24+00:00","dateModified":"2021-08-17T03:15:01+00:00","description":"Learn how to access and use MySQL via command line.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mysql-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Access MySQL via Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed","name":"Scott Mitchell","url":"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=2665"}],"version-history":[{"count":2,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2665\/revisions"}],"predecessor-version":[{"id":84629,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2665\/revisions\/84629"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=2665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=2665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=2665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}