{"id":7828,"date":"2024-04-08T16:38:36","date_gmt":"2024-04-08T11:08:36","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=7828"},"modified":"2024-04-08T16:38:42","modified_gmt":"2024-04-08T11:08:42","slug":"how-to-connect-mysql-via-terminal-and-workbench","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-connect-mysql-via-terminal-and-workbench\/","title":{"rendered":"How to connect MySQL via Terminal and Workbench"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction :&nbsp;<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL is an open-source relational database management system (RDBMS) that enables efficient storage and retrieval of data. It uses a structured query language (SQL) to manage databases, providing a scalable solution for various applications. MySQL is known for its reliability, speed, and ease of use, making it a popular choice for web applications, content management systems, and other data-driven software.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Prerequisites:&nbsp;<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hostname or IP address of the remote MySQL server.<\/li>\n\n\n\n<li>Port number (default is 3306).<\/li>\n\n\n\n<li>Username and password with appropriate privileges.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method 1: Using Terminal<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1: <\/strong>Launch the MySQL client of the remote host.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enter the following command to log in to the Mysql\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u &#091;username] -p &#091;password] -h &#091;host] -P 3306<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If not created any username and password in the local server you can simply enter the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After you press Enter, the system will prompt you to MYSQL Access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3: <\/strong>Exit MySQL<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To exit the MySQL command-line client, you can type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXIT;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will take you back to the regular command prompt.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method 2: Using Workbench<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1<\/strong>: Install and open the MySQL workbench. Click the + icon shown on the home page \u201cMySQL Connections\u201d<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: <\/strong><br><strong>Connect Using Parameters<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><img fetchpriority=\"high\" decoding=\"async\" width=\"624\" height=\"393\" src=\"https:\/\/lh7-us.googleusercontent.com\/h3avvdNEygyCAJpcIsH8gyXxhFOS_14U6FIGX2T0EdnrZ5iTcuCQsXb3KBTwgmBVIsKlmKYR93npnr-Ovmo1t0BBEaGJABa0J9pAkm8QbvRjho6TnvQv-UJDQlLo3Yu_Ds4bMG5o2wo5bSkKolo_mCw\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Connection Name <\/strong>&#8211; The connection name for our reference.<br><strong>Connection Method<\/strong> &#8211; Choose the connection method as Standard TCP\/IP over SSH.<br><strong>SSH Hostname<\/strong> &#8211; Provide the remote system IP and Port. The port must be 22 unless it&#8217;s configured directly on the remote system.<br><strong>SSH Username<\/strong> &#8211; The system username used to connect the remote server.<br><strong>SSH Password OR SSH Key File<\/strong> &#8211; The System User Password or SSH Key File used to connect the remote system over SSH.<br><strong>MySQL Hostname<\/strong> &#8211; Enter your MySQL Remote hostname\/IP address<br><strong>MySQL Server Port &#8211;<\/strong> It must be 3306 unless your remote server is configured to use a different port.<br><strong>Username<\/strong> &#8211; The MySQL server username to open the connection.<br><strong>Password<\/strong> &#8211; The MySQL server user password. You can either store in vault by clicking the Store in Vault Button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, establishing the MySQL connection is successful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Connect using SSL mode:<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Connecting to MySQL with CA certificate verification<\/li>\n\n\n\n<li>If you would like to verify the server CA certificate, you will need the SSL CA certificate file.<\/li>\n\n\n\n<li>Go the the SSL tab as shown below and update the &#8216;use SSL&#8217; and &#8216;SSL CA File&#8217; fields as below<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" width=\"624\" height=\"393\" src=\"https:\/\/lh7-us.googleusercontent.com\/sULj38b97FjxRzL7BdHaXoPznVql8Vyge1TMlgPaXDM5MWqdDFG1SkJ15MAToRsfSQBJ2QLovbpwML5S4cG8C0zpdVj2hhhd1w7NDq-x_FfV75X4VF666BVKQ78apP_4TDx_VVzBcbn6Q2ZxoLoI-jI\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Disable the SSL requirement in MySQL Workbench :<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Choose Use SSL as \u201cRequire\u201d<\/li>\n\n\n\n<li>Move to Advanced tab<\/li>\n\n\n\n<li>Enter \u201cuseSSL =0\u201d in the Others option<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><img decoding=\"async\" width=\"624\" height=\"391\" src=\"https:\/\/lh7-us.googleusercontent.com\/Z-B_tA__4WnAHyfld6067GfAAyfC7Iz507Raqoj6piT6uydBj4e3A82uVfBx9aet4jqSep2sEHNNUqHqByXRnONjY9MqkC-p1ZHhcjbftWO6FP4AY10EOOAUeqE3qVt2tFXD8CrpcEDdZ-CvzT7X4jA\"><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"392\" src=\"https:\/\/lh7-us.googleusercontent.com\/NTL2KCilaWC2KWz_aI1CRX3cmJNyaRmcaoV4E_P-8inpNdxYae0rTqUeKSZL3kBpjU-iDxqdM58SEF0kThxSKlsDYygUbo5WW1UeBjsS3hdkqLAag6EVWga3QY_oLQboFOqZjTiqIB4jx2qqpLCk5To\"><\/strong><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Choose OK.<br>Finally, establishing the MySQL connection is successful.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note :<br>Remove with<br>1. &nbsp;\u201cserver_address\u201d with the IP address or hostname of the remote server.<br>2. \u201cusername\u201d&nbsp; with your actual username.<br>3. &#8220;password&#8221; with your actual password.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction :&nbsp; MySQL is an open-source relational database management system (RDBMS) that enables efficient storage and retrieval of data. It [&hellip;]<\/p>\n","protected":false},"author":509,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_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","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-7828","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-22g","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7828","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/509"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7828"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7828\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}