{"id":372,"date":"2017-07-05T18:09:16","date_gmt":"2017-07-05T12:39:16","guid":{"rendered":"https:\/\/www.coimbatorewebhosting.com\/blog\/?p=372"},"modified":"2017-07-06T15:18:18","modified_gmt":"2017-07-06T09:48:18","slug":"list-of-all-commands-used-in-mysql-ssh-linux-shell-in-putty","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/list-of-all-commands-used-in-mysql-ssh-linux-shell-in-putty\/","title":{"rendered":"List of all commands used in Mysql SSH Linux Shell in PUTTY"},"content":{"rendered":"<p>The following are the list of commands used in mysql to create an data base and manage it for Linux web server.<\/p>\n<p>Start by logging-in using a SSH client, like PUTTY, to access the shell command line.<\/p>\n<p>Before entering this command make sure your will be in<\/p>\n<pre>mysql &gt;<\/pre>\n<p>And at the same time put semi colon (<span style=\"color: #ff0000;\">;<\/span> ) in the last.<\/p>\n<pre>mysql -u [username] -p; (will prompt for password)<\/pre>\n<p>Access monitor-this command will access by <a  href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/how-to-add-global-address-book-plugin-to-round-cube\/\" title=\"entering\" alt=\"entering\">entering<\/a> the username and password which is already created.&nbsp;<\/p>\n<pre>show databases;&nbsp;<\/pre>\n<p>Show all databases-this command will show or list all the database which is created or present.&nbsp;<\/p>\n<pre>mysql -u [username] -p [database];<\/pre>\n<p>(will prompt for password)<br \/>\nAccess database-it will access the database by entering the database name and its password.&nbsp;<\/p>\n<pre>create database [database];&nbsp;<\/pre>\n<p>Create <a  href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/how-to-prevent-breaking-your-live-website-using-staging-feature-in-softaculous\/\" title=\"new\" alt=\"new\">new<\/a> database-this will create a new database with assigned name.&nbsp;<\/p>\n<pre>use [database];&nbsp;<\/pre>\n<p>Select database-this will select the particular database.&nbsp;<\/p>\n<pre>select database();&nbsp;<\/pre>\n<p>This command is used to determine what <a  href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/how-to-increase-the-php-memory-upload-size-in-word-press\/\" title=\"database is\" alt=\"database is\">database is<\/a> in use.&nbsp;<\/p>\n<pre>grant all privileges on database name.* to username@localhost;<\/pre>\n<pre>flush privileges;<\/pre>\n<p>&nbsp;This command is used to Give a user privileges for a database.&nbsp;<\/p>\n<pre>show tables;&nbsp;<\/pre>\n<p>Show all tables.&nbsp;<\/p>\n<pre>describe [table];&nbsp;<\/pre>\n<p>Show table structure.<\/p>\n<pre>show index from [table];&nbsp;<\/pre>\n<p>List all indexes on a table.&nbsp;<\/p>\n<pre>CREATE TABLE [table] ([column] VARCHAR(120), [another-column] DATETIME);&nbsp;<\/pre>\n<p>This will create new table(assign name) with columns and create with date and time.&nbsp;<\/p>\n<pre>ALTER TABLE [table] ADD COLUMN [column] VARCHAR(120);<\/pre>\n<p>This will add an another column in the existing table.<\/p>\n<pre>ALTER TABLE [table] ADD COLUMN [column] int NOT NULL AUTO_INCREMENT PRIMARY KEY;&nbsp;<\/pre>\n<p>It is used for Adding a column with an unique, auto-incrementing ID.<\/p>\n<pre>INSERT INTO [table] ([column], [column]) VALUES ('[value]', [value]');&nbsp;<\/pre>\n<p>It will insert a new record into the table.<\/p>\n<p>&nbsp;NOW()<\/p>\n<p>&nbsp;MySQL function for date time input.&nbsp;<\/p>\n<pre>SELECT * FROM [table];<\/pre>\n<p>&nbsp;This command is used to Selecting records in the table.&nbsp;<\/p>\n<pre>EXPLAIN SELECT * FROM [table];&nbsp;<\/pre>\n<p>This command will Explain records which is present in the selected table.&nbsp;<\/p>\n<pre>SELECT [column], [another-column] FROM [table];&nbsp;<\/pre>\n<p>It is used for Selecting parts of records which is present in the table..&nbsp;<\/p>\n<pre>SELECT COUNT([column]) FROM [table];&nbsp;<\/pre>\n<p>This command is used for Counting records in the table.<\/p>\n<pre>SELECT *, (SELECT COUNT([column]) FROM [table]) AS count FROM [table] GROUP BY [column];&nbsp;<\/pre>\n<p>This command is used for Counting and selecting grouped records.&nbsp;<\/p>\n<pre>SELECT * FROM [table] WHERE [column] LIKE '%[value]%';&nbsp;<\/pre>\n<p>This command is used to Select records containing [value] .<\/p>\n<pre>SELECT * FROM [table] WHERE [column] LIKE '[value]%';&nbsp;<\/pre>\n<p>It is used to Select records starting with [value].<\/p>\n<p>&nbsp;SELECT * FROM [table] WHERE [column] LIKE '[val_ue]';<\/p>\n<p>&nbsp;Select records starting with val and ending with ue.&nbsp;<\/p>\n<pre>SELECT * FROM [table] WHERE [column] BETWEEN [value1] and [value2];&nbsp;<\/pre>\n<p>This is used to Select a range in the table.&nbsp;<\/p>\n<pre>UPDATE [table] SET [column] = '[updated-value]' WHERE [column] = [value];<\/pre>\n<p>This commands is used for Updating records.<\/p>\n<pre>DELETE FROM [table] WHERE [column] = [value];<\/pre>\n<p>This command is used for Deleting records.<\/p>\n<pre>DELETE FROM [table];<\/pre>\n<p>(This also resets the incrementing counter for auto generated columns like an id column.)<\/p>\n<p>Delete all records from a table (without dropping the table itself)<\/p>\n<pre>truncate table [table];<\/pre>\n<p>This command will Delete all records in a table<\/p>\n<pre>ALTER TABLE [table] DROP COLUMN [column];<\/pre>\n<p>Removing table columns.<\/p>\n<pre>DROP TABLE [table];<\/pre>\n<p>Deleting tables.<\/p>\n<pre>DROP DATABASE [database];<\/pre>\n<p>Deleting databases<\/p>\n<pre>SELECT [column] AS [custom-column] FROM [table];<\/pre>\n<p>Custom column output names.<\/p>\n<pre>mysqldump -u [username] -p [database] &gt; db_backup.sql<\/pre>\n<p>Export a database dump (more info here).<\/p>\n<pre>mysql -u [username] -p -h localhost [database] &lt; db_backup.sql<\/pre>\n<p>Import a database dump (more info here)<\/p>\n<pre>exit;<\/pre>\n<p>This command is used to Logout or quit from the mysql.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following are the list of commands used in mysql to create an data base and manage it for Linux web server. Start by logging-in using a SSH client, like PUTTY, to access the shell command line. Before entering this command make sure your will be in mysql &gt; And [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":482,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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}},"categories":[3],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2017\/07\/securely-administer-mysql-with-an-ssh-tunnel.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-60","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=372"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/372\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media\/482"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}