SlideShare ist ein Scribd-Unternehmen logo
1 von 13
J M Githeko
   Client is called “mysql.exe”
   Located in the “bin” directory inside the
    MySQL installation directory
   Called in a command console window
   Connect using:
   mysql -h host -u user -p
   Then supply password from prompt

   host is the IP number or domain name of
    computer hosting MySQL
   user is your user name
 Use “show databases;” to list existing
  databasesat the command prompt (note
  semicolon) as shown:
mysql> show databases;
 To use a specific database, at the command
  prompt, type “use comp361” as shown:
mysql> use comp361
   At command prompt, type “show tables;”

   You can view a table structure by typing
    “describe table_name;”
   table_name is the name of the table
   create database comp361;
CREATE TABLE Students (
   Name VARCHAR(40) NOT NULL,
   ID VARCHAR(40) NOT NULL,
   PRIMARY KEY (ID)
);
   mysql> LOAD DATA LOCAL INFILE “test.txt"
    INTO TABLE pet FIELDS TERMINATED BY XXX
    FIELDS [optionally] ENCLOSED BY YYY LINES
    TERMINATED BY 'rn' ;

 XXX are the characters separating fields (e.g. tab t). YYY
  are characters enclosing fields e.g., ""
 This should be accompanied by a ESCAPED BY
  character.
   mysql> LOAD DATA LOCAL INFILE
    “I:users.csv" INTO TABLE leo FIELDS
    TERMINATED BY ',' LINES TERMINATED BY
    'rn' ;
   [Windows text files need Carriage Return + Line
    Feed line termination (rn)
   Leave out “LOCAL” to load from the server’s
    data directory]
   CREATE TABLE
   UPDATE abc SET xyz
   DROP TABLE abc
    SELECT * FROM efg WHERE ijk = “stu“
   INSERT INTO shop VALUES (1,'A',3.45),…….;
   Learn common MySQL data types
CREATE TABLE course (
   COMP0361 VARCHAR(8),
   Title VARCHAR(50),
   CF REAL UNSIGNED,
   Lecture TINYINT UNSIGNED,
   Tutorial TINYINT,
   Practicals TINYINT,
   Prerequisite1 VARCHAR(8),
   Prerequisite2 VARCHAR(8),
   Prerequisite3 VARCHAR(8),
   Prerequisite4 VARCHAR(8),
   Prerequisite5 VARCHAR(8),
   UNIQUE (COMP0361)
);
   Install MySQL
   Install MySQL Administrator
   Install MySQL Query Browser
   Download and read Read the MySQL
    Manual

Weitere ähnliche Inhalte

Was ist angesagt?

Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and CassandraStore and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
Deependra Ariyadewa
 
7a advanced tsql
7a   advanced tsql7a   advanced tsql
7a advanced tsql
Nauman R
 

Was ist angesagt? (20)

Import and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R StudioImport and Export Excel files using XLConnect in R Studio
Import and Export Excel files using XLConnect in R Studio
 
Import and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R StudioImport and Export Excel Data using openxlsx in R Studio
Import and Export Excel Data using openxlsx in R Studio
 
Export Data using R Studio
Export Data using R StudioExport Data using R Studio
Export Data using R Studio
 
Set operators
Set operatorsSet operators
Set operators
 
Oracle: PLSQL Commands
Oracle: PLSQL CommandsOracle: PLSQL Commands
Oracle: PLSQL Commands
 
Oracle: PLSQL Introduction
Oracle: PLSQL IntroductionOracle: PLSQL Introduction
Oracle: PLSQL Introduction
 
Lab1-DB-Cassandra
Lab1-DB-CassandraLab1-DB-Cassandra
Lab1-DB-Cassandra
 
Les11 Including Constraints
Les11 Including ConstraintsLes11 Including Constraints
Les11 Including Constraints
 
Ado.net by Awais Majeed
Ado.net by Awais MajeedAdo.net by Awais Majeed
Ado.net by Awais Majeed
 
Oracle: DML
Oracle: DMLOracle: DML
Oracle: DML
 
Oracle: Basic SQL
Oracle: Basic SQLOracle: Basic SQL
Oracle: Basic SQL
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
 
Oracle SQL Functions
Oracle SQL FunctionsOracle SQL Functions
Oracle SQL Functions
 
Lab2-DB-Mongodb
Lab2-DB-MongodbLab2-DB-Mongodb
Lab2-DB-Mongodb
 
Les10
Les10Les10
Les10
 
Import Data using R
Import Data using R Import Data using R
Import Data using R
 
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and CassandraStore and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
 
7a advanced tsql
7a   advanced tsql7a   advanced tsql
7a advanced tsql
 
Structured Query Language(SQL)
Structured Query Language(SQL)Structured Query Language(SQL)
Structured Query Language(SQL)
 
Sequences and indexes
Sequences and indexesSequences and indexes
Sequences and indexes
 

Ähnlich wie My sql command line client

MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 

Ähnlich wie My sql command line client (20)

MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Python my SQL - create table
Python my SQL - create tablePython my SQL - create table
Python my SQL - create table
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
 
Deeply Declarative Data Pipelines
Deeply Declarative Data PipelinesDeeply Declarative Data Pipelines
Deeply Declarative Data Pipelines
 
MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
 
Mysql1
Mysql1Mysql1
Mysql1
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Python database access
Python database accessPython database access
Python database access
 
MySql:Introduction
MySql:IntroductionMySql:Introduction
MySql:Introduction
 
MySQL Introduction
MySQL IntroductionMySQL Introduction
MySQL Introduction
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
 
MySQL Basics
MySQL BasicsMySQL Basics
MySQL Basics
 
MySql:Basics
MySql:BasicsMySql:Basics
MySql:Basics
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
 
PHP and Mysql
PHP and MysqlPHP and Mysql
PHP and Mysql
 

Mehr von Egerton University (7)

COMP340 TOPIC 4 THREE.JS.pptx
COMP340 TOPIC 4 THREE.JS.pptxCOMP340 TOPIC 4 THREE.JS.pptx
COMP340 TOPIC 4 THREE.JS.pptx
 
Android ui with xml
Android ui with xmlAndroid ui with xml
Android ui with xml
 
Event handler example
Event handler exampleEvent handler example
Event handler example
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
javascript examples
javascript examplesjavascript examples
javascript examples
 
Php basics
Php basicsPhp basics
Php basics
 
Website management
Website managementWebsite management
Website management
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 

My sql command line client

  • 2. Client is called “mysql.exe”  Located in the “bin” directory inside the MySQL installation directory  Called in a command console window  Connect using:
  • 3. mysql -h host -u user -p  Then supply password from prompt  host is the IP number or domain name of computer hosting MySQL  user is your user name
  • 4.  Use “show databases;” to list existing databasesat the command prompt (note semicolon) as shown: mysql> show databases;  To use a specific database, at the command prompt, type “use comp361” as shown: mysql> use comp361
  • 5. At command prompt, type “show tables;”  You can view a table structure by typing “describe table_name;”  table_name is the name of the table
  • 6. create database comp361;
  • 7. CREATE TABLE Students ( Name VARCHAR(40) NOT NULL, ID VARCHAR(40) NOT NULL, PRIMARY KEY (ID) );
  • 8. mysql> LOAD DATA LOCAL INFILE “test.txt" INTO TABLE pet FIELDS TERMINATED BY XXX FIELDS [optionally] ENCLOSED BY YYY LINES TERMINATED BY 'rn' ;  XXX are the characters separating fields (e.g. tab t). YYY are characters enclosing fields e.g., ""  This should be accompanied by a ESCAPED BY character.
  • 9. mysql> LOAD DATA LOCAL INFILE “I:users.csv" INTO TABLE leo FIELDS TERMINATED BY ',' LINES TERMINATED BY 'rn' ;  [Windows text files need Carriage Return + Line Feed line termination (rn)  Leave out “LOCAL” to load from the server’s data directory]
  • 10. CREATE TABLE  UPDATE abc SET xyz  DROP TABLE abc  SELECT * FROM efg WHERE ijk = “stu“  INSERT INTO shop VALUES (1,'A',3.45),…….;  Learn common MySQL data types
  • 11. CREATE TABLE course ( COMP0361 VARCHAR(8), Title VARCHAR(50), CF REAL UNSIGNED, Lecture TINYINT UNSIGNED, Tutorial TINYINT, Practicals TINYINT, Prerequisite1 VARCHAR(8), Prerequisite2 VARCHAR(8), Prerequisite3 VARCHAR(8), Prerequisite4 VARCHAR(8), Prerequisite5 VARCHAR(8), UNIQUE (COMP0361) );
  • 12. Install MySQL  Install MySQL Administrator  Install MySQL Query Browser
  • 13. Download and read Read the MySQL Manual