{"id":90,"date":"2023-05-06T03:19:43","date_gmt":"2023-05-06T03:19:43","guid":{"rendered":"https:\/\/itnotes.apjsoftwares.com\/?p=90"},"modified":"2023-05-06T03:19:43","modified_gmt":"2023-05-06T03:19:43","slug":"what-are-the-commands-of-mysql","status":"publish","type":"post","link":"https:\/\/itnotes.apjsoftwares.in\/index.php\/2023\/05\/06\/what-are-the-commands-of-mysql\/","title":{"rendered":"What are the commands of MySQL?"},"content":{"rendered":"\n<p>MySQL command-line client commands<\/p>\n\n\n\n<p>This command allows us to connect with MySQL<\/p>\n\n\n\n<p>Server with a username and passwords using below syntax.<\/p>\n\n\n\n<p><strong>mysql -u [username] -p;<\/strong>&nbsp;&nbsp;<\/p>\n\n\n\n<p>If you want to connect with a particular database, use this syntax:<\/p>\n\n\n\n<p><strong>mysql -u [username] -p [database]; <\/strong>&nbsp;<\/p>\n\n\n\n<p>If you want to set a new password, use this syntax:<\/p>\n\n\n\n<p><strong>mysqladmin -u root password your_password;&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>We can use the &#8220;exit&#8221; command to quit the MySQL command-line client.<\/p>\n\n\n\n<p>We can clear the console window in Linux using the below command:<\/p>\n\n\n\n<p><strong>mysql&gt; system clear; <\/strong>&nbsp;<\/p>\n\n\n\n<p><strong>CREATE DATABASE IF NOT EXISTS db_name;&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>If you want to change the current database with another database on which you are working, use the below syntax:<\/p>\n\n\n\n<p><strong>mysql&gt; use db_name;&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>We can delete a particular database along with its associated files permanently using the below syntax:<\/p>\n\n\n\n<p><strong>DROP DATABASE IF EXISTS db_name;&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>To show all databases in the current server, use this syntax:<\/p>\n\n\n\n<p><strong>mysql&gt; SHOW DATABASES; <\/strong>&nbsp;<\/p>\n\n\n\n<p>A table is a collection of related data stored in a row and column format within a database. We can create a new table using the below syntax. It also checks the table name, whether it already exists or not.<\/p>\n\n\n\n<p><strong>CREATE TABLE IF NOT EXISTS tab_name (&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p><strong>&nbsp;&nbsp;column_list (s)&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p><strong>);&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>to add a record into the table, which is given below:<\/p>\n\n\n\n<p><strong>INSERT INTO table_name ( field1, field2,&#8230;fieldN ) VALUES ( value1, value2,&#8230;valueN );&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>We can delete a particular table along permanently using the below syntax:<\/p>\n\n\n\n<p><strong>DROP TABLE IF EXISTS tab_name; <\/strong>&nbsp;<\/p>\n\n\n\n<p><strong>mysql&gt; SHOW TABLES<\/strong>;&nbsp;&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL command-line client commands This command allows us to connect with MySQL Server with a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/90"}],"collection":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":1,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"predecessor-version":[{"id":91,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/90\/revisions\/91"}],"wp:attachment":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}