SlideShare a Scribd company logo
Beginner guide to mysql command line Tool .	Priti Solanki
agendawhat is mysqltool
mysql  tool on windows
mysqlcommands
mysqltipsPriti Solanki
What is “mysql”  !! “mysql” is a simple SQL shell
  It supports interactive and non-interactive mode.On WindowsMake sure you have XAMPP/WAMP installed on your local machine.Open command prompt.Type on command line C:\>mysql	If “'mysql' is not recognized as an internal or external command“ error comes then you have to add the path to mysql bin directory in window’s environment variable.http://dev.mysql.com/doc/refman/5.5/en/mysql-installation-windows-path.htmlPriti Solanki
Mysql CommandConnect to mysqlshell>mysql –hlocalhost –uroot –p          Enter password:Welcome to the MySQL monitor.  Commands end with ;   or \g.            Your MySQL connection id is 22            Server version: 5.1.41 Source distribution            Type 'help;' or '\h' for help. Type '\c' to clear the current   input statement.If you are logged in successfully you will be displayed Welcome message and your prompt will get modified as  mysql>_Show database listmysql> show databases; +--------------------+| Database           |+--------------------+| information_schema || cdcol              || mechanics          || mysql              || ninja_world        || phpmyadmin         || test               |+--------------------+7 rows in set (0.00 sec)Priti Solanki
Mysql CommandHow to select data from tables?Before firing query to mysql you have to let mysql know which database you are going to use.mysql> use ninja_world;        Database changed         listing of tables in this database before I start querying ?mysql> show tables;+-----------------------+| Tables_in_ninja_world |+-----------------------+| ninja                 || power                 |+-----------------------+2 rows in set (0.00 sec)mysql> select * from ninja;+----+----------------+----------+| id | name           | power-id |+----+----------------+----------+|  1 | NarutoUzumaki |        0 ||  2 | Sakura Haruno  |        0 ||  3 | SasukeUchiha  |        0 ||  4 | Rocklee        |        0 ||  5 | ChojiAkimichi |        0 |+----+----------------+----------+Priti Solanki

More Related Content

What's hot (20)

TXT
Oracle ORA Errors
Manish Mudhliyar
 
PPT
Raj mysql
firstplanet
 
ODP
Database Connection With Mysql
Harit Kothari
 
PPTX
MySql:Basics
DataminingTools Inc
 
PPT
My sql with querys
NIRMAL FELIX
 
PPTX
Introduction databases and MYSQL
Naeem Junejo
 
PPTX
My sql administration
Mohd yasin Karim
 
PPTX
Introduction to PostgreSQL
Joel Brewer
 
ODP
Msql
ksujitha
 
ODT
Mysql
ksujitha
 
PDF
BITS: Introduction to MySQL - Introduction and Installation
BITS
 
PDF
Data Processing Inside PostgreSQL
EDB
 
PDF
4.3 MySQL + PHP
Jalpesh Vasa
 
PDF
Introduction to php database connectivity
baabtra.com - No. 1 supplier of quality freshers
 
PDF
BITS: Introduction to relational databases and MySQL - Schema design
BITS
 
PPT
mysqlHiep.ppt
webhostingguy
 
Oracle ORA Errors
Manish Mudhliyar
 
Raj mysql
firstplanet
 
Database Connection With Mysql
Harit Kothari
 
MySql:Basics
DataminingTools Inc
 
My sql with querys
NIRMAL FELIX
 
Introduction databases and MYSQL
Naeem Junejo
 
My sql administration
Mohd yasin Karim
 
Introduction to PostgreSQL
Joel Brewer
 
Msql
ksujitha
 
Mysql
ksujitha
 
BITS: Introduction to MySQL - Introduction and Installation
BITS
 
Data Processing Inside PostgreSQL
EDB
 
4.3 MySQL + PHP
Jalpesh Vasa
 
Introduction to php database connectivity
baabtra.com - No. 1 supplier of quality freshers
 
BITS: Introduction to relational databases and MySQL - Schema design
BITS
 
mysqlHiep.ppt
webhostingguy
 

Viewers also liked (20)

PPTX
Chương 4: MySQL
Hồ Lợi
 
PDF
[Thực tập][GameLoft] Lập trình game đa nền tảng trên di động
Trung Hiếu Trần
 
PDF
Modul MySQL
M Fahmi Ansori
 
PDF
Laravel 5 framework
Trung Hiếu Trần
 
PDF
MySQL 5.4 - Theory and Practice
Giuseppe Maxia
 
PDF
Introduction to MySQL
Giuseppe Maxia
 
PPTX
Aoba 2012 Conference Presentation
eap4j
 
KEY
10 Socially Engaged Nonprofits
Marketwired
 
PPTX
Ceo Chairman Peer Exchange Presentation
eap4j
 
PPT
Leverage social media to grow your business
Marketwired
 
PPTX
Try to get pregnant
gaber hanafy
 
PPTX
Menighedsudvikling 4 - lytterunde
Mogens Mogensen
 
PDF
Techcrunch application
Ben Johnson
 
PPT
динаміка поширення інтернету
korzhenko
 
PPT
2.4.4alphabet Significant
Talia Carbis
 
PPTX
Smx west barbara Starr 2013 (Mac version for video), Schema 201: Real World M...
BarbaraStarr2009
 
PPT
The acadamy and impressionism
robert ponzio
 
PPT
Is There A You In Team Feb 25 2009 At The University Of Waterloo
jimlove
 
PPT
2.4.2fundamental
Talia Carbis
 
PPT
Introduction to Belief
gaber hanafy
 
Chương 4: MySQL
Hồ Lợi
 
[Thực tập][GameLoft] Lập trình game đa nền tảng trên di động
Trung Hiếu Trần
 
Modul MySQL
M Fahmi Ansori
 
Laravel 5 framework
Trung Hiếu Trần
 
MySQL 5.4 - Theory and Practice
Giuseppe Maxia
 
Introduction to MySQL
Giuseppe Maxia
 
Aoba 2012 Conference Presentation
eap4j
 
10 Socially Engaged Nonprofits
Marketwired
 
Ceo Chairman Peer Exchange Presentation
eap4j
 
Leverage social media to grow your business
Marketwired
 
Try to get pregnant
gaber hanafy
 
Menighedsudvikling 4 - lytterunde
Mogens Mogensen
 
Techcrunch application
Ben Johnson
 
динаміка поширення інтернету
korzhenko
 
2.4.4alphabet Significant
Talia Carbis
 
Smx west barbara Starr 2013 (Mac version for video), Schema 201: Real World M...
BarbaraStarr2009
 
The acadamy and impressionism
robert ponzio
 
Is There A You In Team Feb 25 2009 At The University Of Waterloo
jimlove
 
2.4.2fundamental
Talia Carbis
 
Introduction to Belief
gaber hanafy
 
Ad

Similar to Beginner guide to mysql command line (20)

PPT
MySQL and its basic commands
Bwsrang Basumatary
 
PDF
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
PPT
MySQL Database System Hiep Dinh
webhostingguy
 
PPT
MySql slides (ppt)
webhostingguy
 
PDF
My sql università di enna a.a. 2005-06
YUCHENG HU
 
PPTX
Using Mysql.pptx
StephenEfange3
 
PPT
Mysql
Deepa Lakshmi
 
PPTX
Mysql
lotlot
 
PPTX
PHP mysql Introduction database
Mudasir Syed
 
PPTX
Introduction To MySQL Lecture 1
Ajay Khatri
 
PPT
MYSQL
ARJUN
 
PPT
MySQL ppt
AtharvaSawant10
 
ODP
Mysql
merlin deepika
 
PPT
Mysql
HAINIRMALRAJ
 
PPT
Getting started into mySQL
Siddique Ibrahim
 
PPT
PHP tips by a MYSQL DBA
Amit Kumar Singh
 
PPT
Mysqlppt3510
Anuja Lad
 
PPT
Mysqlppt3510
Khan Rahimeen
 
MySQL and its basic commands
Bwsrang Basumatary
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
pradnyamulay
 
MySQL Database System Hiep Dinh
webhostingguy
 
MySql slides (ppt)
webhostingguy
 
My sql università di enna a.a. 2005-06
YUCHENG HU
 
Using Mysql.pptx
StephenEfange3
 
Mysql
lotlot
 
PHP mysql Introduction database
Mudasir Syed
 
Introduction To MySQL Lecture 1
Ajay Khatri
 
MYSQL
ARJUN
 
MySQL ppt
AtharvaSawant10
 
Getting started into mySQL
Siddique Ibrahim
 
PHP tips by a MYSQL DBA
Amit Kumar Singh
 
Mysqlppt3510
Anuja Lad
 
Mysqlppt3510
Khan Rahimeen
 
Ad

Recently uploaded (20)

PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Digital Circuits, important subject in CS
contactparinay1
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 

Beginner guide to mysql command line

  • 1. Beginner guide to mysql command line Tool . Priti Solanki
  • 3. mysql tool on windows
  • 6. What is “mysql” !! “mysql” is a simple SQL shell
  • 7. It supports interactive and non-interactive mode.On WindowsMake sure you have XAMPP/WAMP installed on your local machine.Open command prompt.Type on command line C:\>mysql If “'mysql' is not recognized as an internal or external command“ error comes then you have to add the path to mysql bin directory in window’s environment variable.http://dev.mysql.com/doc/refman/5.5/en/mysql-installation-windows-path.htmlPriti Solanki
  • 8. Mysql CommandConnect to mysqlshell>mysql –hlocalhost –uroot –p Enter password:Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: 5.1.41 Source distribution  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.If you are logged in successfully you will be displayed Welcome message and your prompt will get modified as mysql>_Show database listmysql> show databases; +--------------------+| Database |+--------------------+| information_schema || cdcol || mechanics || mysql || ninja_world || phpmyadmin || test |+--------------------+7 rows in set (0.00 sec)Priti Solanki
  • 9. Mysql CommandHow to select data from tables?Before firing query to mysql you have to let mysql know which database you are going to use.mysql> use ninja_world; Database changed listing of tables in this database before I start querying ?mysql> show tables;+-----------------------+| Tables_in_ninja_world |+-----------------------+| ninja || power |+-----------------------+2 rows in set (0.00 sec)mysql> select * from ninja;+----+----------------+----------+| id | name | power-id |+----+----------------+----------+| 1 | NarutoUzumaki | 0 || 2 | Sakura Haruno | 0 || 3 | SasukeUchiha | 0 || 4 | Rocklee | 0 || 5 | ChojiAkimichi | 0 |+----+----------------+----------+Priti Solanki
  • 10. How to insert data in a table?mysql> use ninja_world; Database changedmysql> INSERT INTO ninja( `name` , `power-id` ) -> VALUES ( -> 'komizkhazi', '1' -> ); Query OK, 1 row affected (0.00 sec)How to update data in a table?mysql> Update ninja SET name="psolanki" where id=16;Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0How to delete data from a table?mysql> delete from ninja where id=16;Query OK, 1 row affected (0.00 sec)Priti Solanki
  • 11. mysqlTipsUse ‘- -quick’ option to retrieve results from the server a row at a time rather than retrieving the entire result set and buffering it in memory before displaying it.
  • 12. Some time query results are more readable when displayed vertically.mysql> select * from mechanic where if=101\G Press enter. The output will be formatted as shown belowFor tabular output, use “- - raw” OR “-r” mysql options. shell> mysql -r -uroot -e "SHOW VARIABLES LIKE 'version%'";+-------------------------+---------------------+| Variable_name | Value |+-------------------------+---------------------+| version | 5.1.41 || version_comment | Source distribution || version_compile_machine | ia32 || version_compile_os | Win32 |+-------------------------+---------------------+Priti Solanki
  • 13. Continue….Get xml output of your mysql query. shell> mysql -X -uroot -e "USE ninja_world;select * from ninja LIMIT 1"; <?xml version="1.0"?><resultset statement="select * from ninja" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <row> <field name="id">1</field> <field name="name">NarutoUzumaki</field> <field name="power-id">0</field> </row></resultset>Get html output from mysql query.shell> mysql --html -uroot -e "USE ninja_world;select * from ninja LIMIT 1";<TABLE BORDER=1><TR><TH>id</TH><TH>name</TH><TH>power-id</TH></TR><TR><TD>1</TD><TD>NarutoUzumaki</TD><TD>0</TD></TR></TABLE>Priti Solanki
  • 14. Continue….To reconfigure the mysql prompt.mysql> \R ninja> ninja>Read the source file and executes the statements (in windows).mysql> source c:\\test.sql Database changed+----+----------------+----------+| id | name | power-id |+----+----------------+----------+| 1 | NarutoUzumaki | 0 || 2 | Sakura Haruno | 0 || 3 | SasukeUchiha | 0 || 4 | Rocklee | 0 |Test.sql is a sql file which contains following sql statementUse ninja_world;Select * from ninja;From here you are good to go for your own  !!. For any modification, correction or suggestion which can make this presentation good for beginners please care to drop a line on [email protected] Solanki