{"id":9007,"date":"2019-09-27T19:27:40","date_gmt":"2019-09-28T02:27:40","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=9007"},"modified":"2024-01-14T21:01:08","modified_gmt":"2024-01-15T04:01:08","slug":"connect-to-mysql-server","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/","title":{"rendered":"Connect to MySQL Server"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to connect to MySQL Server using mysql command-line client and MySQL Workbench.<\/p>\n\n\n\n<p>Once you have the <a href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/install-mysql\/\">MySQL Server installed<\/a>, you can connect to it using any client program such as mysql command-line client and MySQL workbench.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connect to MySQL Using mysql command-line client<\/h2>\n\n\n\n<p>The mysql is a command-line client program that allows you to interact with MySQL in interactive and non-interactive modes.<\/p>\n\n\n\n<p>The mysql command-line client is typically located in the <code>bin<\/code> directory of MySQL&#8217;s installation directory such as <code>C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin<\/code> on Windows.<\/p>\n\n\n\n<p>To invoke the mysql program, you open the <strong>Command Prompt<\/strong> on Windows or Termina on Unix-like systems and navigate to the <code>bin<\/code> directory of the MySQL installation directory:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"note\">The Command Prompt is a command-line interpreter program available in Windows. The Command Prompt program allows you to interact with the computer through text-based commands for tasks like running programs, managing files, and configuring system settings.<\/p>\n\n\n\n<p>If the <code>bin<\/code> directory is included in the <code>PATH<\/code>, you can use the <code>mysql<\/code> command from the Command Prompt without the need to navigate to the <code>bin<\/code> directory.<\/p>\n\n\n\n<p class=\"note\">On Windows, the <code>PATH<\/code> is an environment variable that contains a list of directories. Windows OS uses these directories to locate executable files, making it easier to run applications from the Command Prompt without specifying the full file path.<\/p>\n\n\n\n<p>To connect to the MySQL Server, you type this command on Command Prompt:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">mysql -u root -p<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this command:<\/p>\n\n\n\n<p><code>-u root<\/code> means that you connect to the MySQL Server using the user <code>root<\/code>.<\/p>\n\n\n\n<p><code>-p<\/code> instructs mysql to prompt for a password.<\/p>\n\n\n\n<p>You type the password for the <code>root<\/code> user and press Enter:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">Enter password: ********<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If everything is OK, you will connect to the MySQL Server and see the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">mysql&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To display available databases in the current server, you enter the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-show-databases\/\">SHOW DATABASES<\/a><\/code> statement terminated by a semicolon (;) and press the Enter key:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">show<\/span> <span class=\"hljs-keyword\">databases<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The mysql program will return the following output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">+<span class=\"hljs-comment\">--------------------+<\/span>\n| Database           |\n+<span class=\"hljs-comment\">--------------------+<\/span>\n| information_schema |\n| mysql              |\n| performance_schema |\n| sys                |\n+<span class=\"hljs-comment\">--------------------+<\/span>\n4 rows in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.01<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Here are the steps that occur behind the scenes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, the mysql command-line client sends the query to the MySQL Server.<\/li>\n\n\n\n<li>Second, the MySQL server executes the query and sends the result back.<\/li>\n\n\n\n<li>Third, the mysql command-line client displays the result.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Connect to MySQL database server using MySQL Workbench<\/h2>\n\n\n\n<p>Step 1. Launch the MySQL Workbench.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"966\" height=\"593\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png\" alt=\"connect to mysql - mysql workbench step 1\" class=\"wp-image-9008\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png 966w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1-200x123.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1-768x471.png 768w\" sizes=\"auto, (max-width: 966px) 100vw, 966px\" \/><\/figure>\n\n\n\n<p>You can connect to a MySQL Server using the <strong>Database &gt; Connect to Database&#8230;<\/strong> menu or click the + button that is located next to the MySQL Connections.<\/p>\n\n\n\n<p>Click the + button next to the MySQL Connections to continue.<\/p>\n\n\n\n<p>Step 2. Enter the connection name e.g., Localhost. You can name it whatever makes sense to you. By default, the username is <code>root<\/code>. If you use a different user account, you can change it in the Username textbox.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"493\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-2.png\" alt=\"connect to mysql - mysql workbench step 2\" class=\"wp-image-9009\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-2.png 786w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-2-200x125.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-2-768x482.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>Step 3. Click the <code>Store in Vault ...<\/code> button to enter the password for the provided user account. A window will display. You enter the password and click the OK button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"493\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-3.png\" alt=\"\" class=\"wp-image-9010\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-3.png 786w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-3-200x125.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-3-768x482.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>Step 4. Click the Test Connection button to test if the connection to the MySQL Server is successful or not. Then click the OK button if the connection is established successfully.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"493\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-4.png\" alt=\"connect to mysql - mysql workbench step 4\" class=\"wp-image-9011\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-4.png 786w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-4-200x125.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-4-768x482.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>Step 5. Click the OK button to save the connection.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"493\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-5.png\" alt=\"connect to mysql - mysql workbench step 5\" class=\"wp-image-9012\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-5.png 786w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-5-200x125.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-5-768x482.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>Step 6. Click the newly created connection under MySQL Connections to connect to the MySQL Server:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"966\" height=\"593\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-6.png\" alt=\"connect to mysql - mysql workbench step 6\" class=\"wp-image-9013\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-6.png 966w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-6-200x123.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-6-768x471.png 768w\" sizes=\"auto, (max-width: 966px) 100vw, 966px\" \/><\/figure>\n\n\n\n<p>Step 7. MySQL Workbench display with the current schemas and a pane for entering queries:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"966\" height=\"593\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-7.png\" alt=\"connect to mysql - mysql workbench step 7\" class=\"wp-image-9014\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-7.png 966w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-7-200x123.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-7-768x471.png 768w\" sizes=\"auto, (max-width: 966px) 100vw, 966px\" \/><\/figure>\n\n\n\n<p>To execute a query from the MySQL Workbench, you enter the query in the query tab (1) and click the Execute button from the toolbar (2).<\/p>\n\n\n\n<p>MySQL Workbench will send the query to the MySQL Server and get the result back (3 + 4):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"689\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/MySQL-Workbench-Execute-a-query.png\" alt=\"\" class=\"wp-image-11648\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/MySQL-Workbench-Execute-a-query.png 982w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/MySQL-Workbench-Execute-a-query-200x140.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/MySQL-Workbench-Execute-a-query-768x539.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure>\n\n\n\n<p>In this tutorial, you have learned how to connect to the MySQL Server using mysql command-line client and MySQL Workbench.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"9007\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/\"\n\t\t\t\tdata-post-title=\"Connect to MySQL Server\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"9007\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/\"\n\t\t\t\tdata-post-title=\"Connect to MySQL Server\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":9017,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9007","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Connect to MySQL Server<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.\" \/>\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.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Connect to MySQL Server\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T04:01:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/\",\"name\":\"How to Connect to MySQL Server\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/connect-to-mysql-mysql-workbench-step-1.png\",\"datePublished\":\"2019-09-28T02:27:40+00:00\",\"dateModified\":\"2024-01-15T04:01:08+00:00\",\"description\":\"In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/connect-to-mysql-mysql-workbench-step-1.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/connect-to-mysql-mysql-workbench-step-1.png\",\"width\":966,\"height\":593,\"caption\":\"connect to mysql - mysql workbench step 1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/connect-to-mysql-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting Started with MySQL\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/getting-started-with-mysql\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Connect to MySQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Connect to MySQL Server","description":"In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.","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.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/","og_locale":"en_US","og_type":"article","og_title":"How to Connect to MySQL Server","og_description":"In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.","og_url":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/","og_site_name":"MySQL Tutorial","article_modified_time":"2024-01-15T04:01:08+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/","url":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/","name":"How to Connect to MySQL Server","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png","datePublished":"2019-09-28T02:27:40+00:00","dateModified":"2024-01-15T04:01:08+00:00","description":"In this tutorial, you will learn how to connect to MySQL Server using the mysql command-line client program and MySQL Workbench.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/connect-to-mysql-mysql-workbench-step-1.png","width":966,"height":593,"caption":"connect to mysql - mysql workbench step 1"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/connect-to-mysql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"Getting Started with MySQL","item":"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/"},{"@type":"ListItem","position":3,"name":"Connect to MySQL Server"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/9007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=9007"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/9007\/revisions"}],"predecessor-version":[{"id":14573,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/9007\/revisions\/14573"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/9017"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=9007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}