{"id":108,"date":"2019-12-04T10:13:34","date_gmt":"2019-12-04T10:13:34","guid":{"rendered":"http:\/\/tiruppurwebhosting.com\/blog\/?p=108"},"modified":"2019-12-04T10:26:30","modified_gmt":"2019-12-04T10:26:30","slug":"list-of-all-commands-used-in-mysql-ssh-linux-shell-in-putty","status":"publish","type":"post","link":"https:\/\/tiruppurwebhosting.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 (; ) 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 title=\"entering\" href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/how-to-add-global-address-book-plugin-to-round-cube\/\" target=\"_blank\" rel=\"noopener\">entering<\/a> the username and password which is already created.<\/p>\n<pre>show databases;<\/pre>\n<p>Show all databases-this command will show or list all the database which is created or present.<\/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.<\/p>\n<pre>create database [database];<\/pre>\n<p>Create <a title=\"new\" href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/how-to-prevent-breaking-your-live-website-using-staging-feature-in-softaculous\/\" target=\"_blank\" rel=\"noopener\">new<\/a> database-this will create a new database with assigned name.<\/p>\n<pre>use [database];<\/pre>\n<p>Select database-this will select the particular database.<\/p>\n<pre>select database();<\/pre>\n<p>This command is used to determine what <a title=\"database is\" href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/how-to-increase-the-php-memory-upload-size-in-word-press\/\" target=\"_blank\" rel=\"noopener\">database is<\/a> in use.<\/p>\n<pre>grant all privileges on database name.* to username@localhost;<\/pre>\n<pre>flush privileges;<\/pre>\n<p>This command is used to Give a user privileges for a database.<\/p>\n<pre>show tables;<\/pre>\n<p>Show all tables.<\/p>\n<pre>describe [table];<\/pre>\n<p>Show table structure.<\/p>\n<pre>show index from [table];<\/pre>\n<p>List all indexes on a table.<\/p>\n<pre>CREATE TABLE [table] ([column] VARCHAR(120), [another-column] DATETIME);<\/pre>\n<p>This will create new table(assign name) with columns and create with date and time.<\/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;<\/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]');<\/pre>\n<p>It will insert a new record into the table.<\/p>\n<p>NOW()<\/p>\n<p>MySQL function for date time input.<\/p>\n<pre>SELECT * FROM [table];<\/pre>\n<p>This command is used to Selecting records in the table.<\/p>\n<pre>EXPLAIN SELECT * FROM [table];<\/pre>\n<p>This command will Explain records which is present in the selected table.<\/p>\n<pre>SELECT [column], [another-column] FROM [table];<\/pre>\n<p>It is used for Selecting parts of records which is present in the table..<\/p>\n<pre>SELECT COUNT([column]) FROM [table];<\/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];<\/pre>\n<p>This command is used for Counting and selecting grouped records.<\/p>\n<pre>SELECT * FROM [table] WHERE [column] LIKE '%[value]%';<\/pre>\n<p>This command is used to Select records containing [value] .<\/p>\n<pre>SELECT * FROM [table] WHERE [column] LIKE '[value]%';<\/pre>\n<p>It is used to Select records starting with [value].<\/p>\n<p>SELECT * FROM [table] WHERE [column] LIKE &#8216;[val_ue]&#8217;;<\/p>\n<p>Select records starting with val and ending with ue.<\/p>\n<pre>SELECT * FROM [table] WHERE [column] BETWEEN [value1] and [value2];<\/pre>\n<p>This is used to Select a range in the table.<\/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 at the same time put<\/p>\n","protected":false},"author":1,"featured_media":110,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,9,3],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-basics","category-linux","category-linux-tutorials"],"_links":{"self":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":0,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/media\/110"}],"wp:attachment":[{"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiruppurwebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}