bipul7

Untitled

Mar 6th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. In the example below, testdb is the name of the database, testuser is the user, and password is the user’s password.
  2.  
  3. create database testdb;
  4. create user 'testuser'@'localhost' identified by 'password';
  5. grant all on testdb.* to 'testuser';
  6.  
  7.  
  8. CREATE TABLE Crossgate (INCIDENT INT, NAME VARCHAR(20) NOT NULL, EMAIL VARCHAR(20) NOT NULL);
  9. SHOW TABLES;
  10.  
  11. INSERT INTO Crossgate (INCIDENT,NAME,EMAIL) VALUES(1020,"Bipul kumar","sir.isac@gmail.com");INSERT INTO Crossgate (INCIDENT,NAME,EMAIL) VALUES(1021,"Atul kumar","Atul@gmail.com");
  12.  
  13. INSERT INTO Crossgate (INCIDENT,NAME,EMAIL) VALUES(1022,"Anuradha ","Anuradha@gmail.com");
  14. Query OK, 1 row affected (0.06 sec)
  15.  
  16. SELECT * FROM Crossgate;
  17.  
  18.  
  19. When you wants to insert .csv file into table use
  20. mysql --local-infile=1 -u username -p
  21. LOAD DATA LOCAL INFILE '/home/bipul/testlist.csv' INTO TABLE Crossgate;
  22.  
  23. Deleting all table details
  24. delete from tableName.
Add Comment
Please, Sign In to add comment