{"id":14520,"date":"2024-01-11T20:30:09","date_gmt":"2024-01-12T03:30:09","guid":{"rendered":"https:\/\/www.mysqltutorial.org\/?page_id=14520"},"modified":"2024-01-11T20:47:47","modified_gmt":"2024-01-12T03:47:47","slug":"mysql-commands","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/","title":{"rendered":"MySQL Commands"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the MySQL commands of the mysql client tool.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connect to a MySQL server<\/h2>\n\n\n\n<p>To connect to a MySQL server, you need to provide the following information:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Server host<\/strong>: can be an IP address or URL, default to <code>localhost<\/code>.<\/li>\n\n\n\n<li><strong>Port<\/strong>: the port of the MySQL server, default to <code>3306<\/code>.<\/li>\n\n\n\n<li><strong>Username<\/strong>: the user account to connect to the MySQL server.<\/li>\n\n\n\n<li><strong>Password<\/strong>: the password of the user that you want to connect.<\/li>\n<\/ul>\n\n\n\n<p>Optionally, you can specify a specific database name to which you want to connect.<\/p>\n\n\n\n<p>If you don&#8217;t want to connect to the MySQL server without providing a username and password, you can <a href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql_config_editor\/\">set up one or more login paths<\/a>, which is very convenient &amp; secure.<\/p>\n\n\n\n<p>The following illustrates various mysql commands that connect to a local\/remote MySQL server:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to a Local MySQL server<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Shell Session\" data-shcb-language-slug=\"shell\"><span><code class=\"hljs language-shell\">mysql -u username -p<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Shell Session<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">shell<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Replace <code>username<\/code> with your MySQL username. You will be prompted to enter your password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to Local MySQL server with database<\/h3>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Shell Session\" data-shcb-language-slug=\"shell\"><span><code class=\"hljs language-shell\">mysql -u username -p db_name<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Shell Session<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">shell<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Replace <code>username<\/code> with your MySQL username and <code>db_name<\/code> with the specific database you want to connect to. You will be prompted to enter your password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to Remote MySQL Server<\/h3>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mysql -h remote_host -u username -p<\/code><\/span><\/pre>\n\n\n<p>Replace <code>remote_host<\/code> with the IP address or hostname of the remote MySQL server, and <code>username<\/code> with your MySQL username. You will be prompted to enter your password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to Remote MySQL Server with Database<\/h3>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mysql -h remote_host -u username -p db_name<\/code><\/span><\/pre>\n\n\n<p>Replace <code>remote_host<\/code> with the IP address or hostname of the remote MySQL server, <code>username<\/code> with your MySQL username, and <code>db_name<\/code> with the specific database you want to connect to. You will be prompted to enter your password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Specify MySQL server port<\/h3>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mysql -h remote_host -P port -u username -p<\/code><\/span><\/pre>\n\n\n<p>Replace <code>remote_host<\/code> with the IP address or hostname of the remote MySQL server, <code>port<\/code> with the port number (default is 3306), and <code>username<\/code> with your MySQL username. You will be prompted to enter your password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to a MySQL server using a login path<\/h3>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mysql --login-path=mypath<\/code><\/span><\/pre>\n\n\n<p>Replace the <code>mypath<\/code> with your <a href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql_config_editor\/\">login path<\/a>. If you omit the <code>--login-path<\/code>, mysql will read the default login path:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mysql<\/code><\/span><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Connect to MySQL Server with SSL<\/h3>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mysql -h remote_host -u username -p --ssl-ca=ca.pem --ssl-cert=client-cert.pem --ssl-key=client-key.pem<\/code><\/span><\/pre>\n\n\n<p>Replace <code>remote_host<\/code> with the IP address or hostname of the remote MySQL server, <code>username<\/code> with your MySQL username, and specify the paths to your SSL certificates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Exit MySQL client<\/h2>\n\n\n\n<p>To exit the mysql client, you can use one of the following mysql commands:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">\\q<\/code><\/span><\/pre>\n\n\n<p>Or<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">quit<\/code><\/span><\/pre>\n\n\n<p>Or<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">exit<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Alternatively, you can use the shortcut key\u00a0<code>Ctrl+D<\/code> on Unix-like systems or\u00a0<code>Ctrl+Z<\/code>\u00a0on Windows.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Format query results<\/h2>\n\n\n\n<p>By default, MySQL displays query results in a horizontal format:<\/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\"><span class=\"hljs-keyword\">SELECT<\/span> \n  firstName, \n  lastName \n<span class=\"hljs-keyword\">FROM<\/span> \n  employees \n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> firstName\n<span class=\"hljs-keyword\">LIMIT<\/span>\n  <span class=\"hljs-number\">2<\/span>;<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+-----------+----------+\n| firstName | lastName |\n+-----------+----------+\n| Andy      | Fixter   |\n| Anthony   | Bow      |\n+-----------+----------+\n<span class=\"hljs-number\">2<\/span> rows <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If the number of columns is high, the output will not be readable. To fix it, you can display the query results in a vertical format using the \\G instead of the semicolon (;):<\/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-keyword\">SELECT<\/span> \n  firstName, \n  lastName \n<span class=\"hljs-keyword\">FROM<\/span> \n  employees \n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> firstName\n<span class=\"hljs-keyword\">LIMIT<\/span>\n  <span class=\"hljs-number\">2<\/span>\\G<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">*************************** <span class=\"hljs-number\">1.<\/span> row ***************************\nfirstName: Andy\n <span class=\"hljs-attr\">lastName<\/span>: Fixter\n*************************** <span class=\"hljs-number\">2.<\/span> row ***************************\nfirstName: Anthony\n <span class=\"hljs-attr\">lastName<\/span>: Bow\n<span class=\"hljs-number\">2<\/span> rows <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Execute a command and exit<\/h2>\n\n\n\n<p>If you want to execute a single SQL statement and exit, you can use the <code>-e<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">mysql -u username -p -e <span class=\"hljs-string\">\"SELECT * FROM table_name;\"<\/span> db_name<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Replace <code>username<\/code>, SQL statement, <code>db_name<\/code> with your actual MySQL username, SQL statement, and database name. You will be prompted to enter your password.<\/p>\n\n\n\n<p>For example, the following command executes a query that retrieves <code>firstName<\/code> and <code>lastName<\/code> from the <code>employees<\/code> table in the sample database <code>classicmodels<\/code>.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"> mysql -u root -p -e <span class=\"hljs-string\">\"SELECT firstName, lastName FROM employees ORDER BY firstName LIMIT 2\"<\/span> classicmodels;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">+-----------+----------+\n| firstName | lastName |\n+-----------+----------+\n| Andy      | Fixter   |\n| Anthony   | Bow      |\n+-----------+----------+<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Execute queries from a file<\/h2>\n\n\n\n<p>The following command executes queries from a file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">mysql<\/span> <span class=\"hljs-selector-tag\">-u<\/span> <span class=\"hljs-selector-tag\">username<\/span> <span class=\"hljs-selector-tag\">-p<\/span> <span class=\"hljs-selector-tag\">db_name<\/span> &lt; <span class=\"hljs-selector-tag\">script<\/span><span class=\"hljs-selector-class\">.sql<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Replace <code>username<\/code>, <code>db_name<\/code>, and <code>script.sql<\/code> with your actual MySQL username, database, and the path to your SQL script file, respectively. <\/p>\n\n\n\n<p>After running the command, you will be prompted to enter your password.<\/p>\n\n\n\n<p>For example, the following command executes SQL statements from a <code>query.sql<\/code> file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">mysql<\/span> <span class=\"hljs-selector-tag\">-u<\/span> <span class=\"hljs-selector-tag\">root<\/span> <span class=\"hljs-selector-tag\">-p<\/span> <span class=\"hljs-selector-tag\">classicmodels<\/span> &lt; <span class=\"hljs-selector-tag\">query<\/span><span class=\"hljs-selector-class\">.sql<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">firstName       lastName\nAndy    Fixter\nAnthony Bow<\/code><\/span><\/pre>\n\n\n<p>The contents of <code>query.sql<\/code> file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">select<\/span> firstName, lastName\n<span class=\"hljs-keyword\">from<\/span> employees\n<span class=\"hljs-keyword\">order<\/span> <span class=\"hljs-keyword\">by<\/span> firstName\n<span class=\"hljs-keyword\">limit<\/span> <span class=\"hljs-number\">2<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><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>You can also use the result of another command as an input for mysql using the <code>|<\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">cat query.sql | mysql -u root -p classicmodels<\/code><\/span><\/pre>\n\n\n<p>Note that this command works on Unix-like systems such as macOS and Ubuntu.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Write a query result to a file<\/h2>\n\n\n\n<p>To write a query to a file, you use the <code>><\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">mysql -u username -p db_name -e <span class=\"hljs-string\">\"select * from tblName\"<\/span> &gt; path\/to\/file<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Replace <code>username<\/code>, <code>db_name<\/code>, <code>query<\/code>, and path to the output file with your actual MySQL username, database, query, and the path to your output file respectively. <\/p>\n\n\n\n<p>For example, the following command selects all rows from the <code>employees<\/code> table in the <code>classicmodels<\/code> database and writes the data to the employee.txt file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">mysql -u root -p classicmodels -e <span class=\"hljs-string\">\"select * from employees\"<\/span> &gt; employees.txt<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><\/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=\"14520\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/\"\n\t\t\t\tdata-post-title=\"MySQL Commands\"\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=\"14520\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/\"\n\t\t\t\tdata-post-title=\"MySQL Commands\"\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 use the most commonly used MySQL commands of the mysql client tool.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":174,"menu_order":108,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-14520","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>MySQL Commands<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use the most commonly used MySQL commands of the mysql client tool.\" \/>\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\/mysql-basics\/mysql-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Commands\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use the most commonly used MySQL commands of the mysql client tool.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-12T03:47:47+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/mysql-commands\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/mysql-commands\\\/\",\"name\":\"MySQL Commands\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"datePublished\":\"2024-01-12T03:30:09+00:00\",\"dateModified\":\"2024-01-12T03:47:47+00:00\",\"description\":\"In this tutorial, you will learn how to use the most commonly used MySQL commands of the mysql client tool.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/mysql-commands\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/mysql-commands\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/mysql-commands\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Basics\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL Commands\"}]},{\"@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":"MySQL Commands","description":"In this tutorial, you will learn how to use the most commonly used MySQL commands of the mysql client tool.","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\/mysql-basics\/mysql-commands\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Commands","og_description":"In this tutorial, you will learn how to use the most commonly used MySQL commands of the mysql client tool.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/","og_site_name":"MySQL Tutorial","article_modified_time":"2024-01-12T03:47:47+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/","url":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/","name":"MySQL Commands","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"datePublished":"2024-01-12T03:30:09+00:00","dateModified":"2024-01-12T03:47:47+00:00","description":"In this tutorial, you will learn how to use the most commonly used MySQL commands of the mysql client tool.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Basics","item":"https:\/\/www.mysqltutorial.org\/mysql-basics\/"},{"@type":"ListItem","position":3,"name":"MySQL Commands"}]},{"@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\/14520","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=14520"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/14520\/revisions"}],"predecessor-version":[{"id":14535,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/14520\/revisions\/14535"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=14520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}