J M Githeko
   Client is called “mysql.exe”   Located in the “bin” directory inside the    MySQL installation directory   Called in...
   mysql -h host -u user -p   Then supply password from prompt   host is the IP number or domain name of    computer ho...
 Use “show databases;” to list existing  databasesat the command prompt (note  semicolon) as shown:mysql> show databases;...
   At command prompt, type “show tables;”   You can view a table structure by typing    “describe table_name;”   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...
   mysql> LOAD DATA LOCAL INFILE    “I:users.csv" INTO TABLE leo FIELDS    TERMINATED BY , LINES TERMINATED BY    rn ;  ...
   CREATE TABLE   UPDATE abc SET xyz   DROP TABLE abc    SELECT * FROM efg WHERE ijk = “stu“   INSERT INTO shop VALUE...
CREATE TABLE course (   COMP0361 VARCHAR(8),   Title VARCHAR(50),   CF REAL UNSIGNED,   Lecture TINYINT UNSIGNED,   Tutori...
   Install MySQL   Install MySQL Administrator   Install MySQL Query Browser
   Download and read Read the MySQL    Manual
Upcoming SlideShare
Loading in …5
×

My sql command line client

2,721 views

Published on

Basic MySQL managment

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
2,721
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
25
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

My sql command line client

  1. 1. J M Githeko
  2. 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. 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. 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. 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. 6.  create database comp361;
  7. 7. CREATE TABLE Students ( Name VARCHAR(40) NOT NULL, ID VARCHAR(40) NOT NULL, PRIMARY KEY (ID));
  8. 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. 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. 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. 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. 12.  Install MySQL Install MySQL Administrator Install MySQL Query Browser
  13. 13.  Download and read Read the MySQL Manual

×