Các lệnh cơ bản của MySQL P4

Written on 03/03/2010 – 10:12 | by hanh_bk |

Load a CSV file into a table. mysql> LOAD DATA INFILE ‘/tmp/filename.csv’ replace INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1,field2,field3); Dump all databases for backup. Backup file is sql commands to recreate all db’s. # [mysql dir]/bin/mysqldump -u root -ppassword –opt >/tmp/alldatabases.sql Dump one database for backup. # [mysql [...]

Tags: ,

Các lệnh cơ bản của MySQL P3

Written on 03/03/2010 – 10:11 | by hanh_bk |

Join tables on common columns. mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id; Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs. # mysql -u root -p mysql> use mysql; mysql> INSERT INTO user [...]

Tags: ,

Các lệnh cơ bản của MySQL P2.

Written on 03/03/2010 – 10:09 | by hanh_bk |

Show all records containing the name “Bob” AND the phone number ’3444444′. mysql> SELECT * FROM [table name] WHERE name = “Bob” AND phone_number = ’3444444′; Show all records not containing the name “Bob” AND the phone number ’3444444′ order by the phone_number field. mysql> SELECT * FROM [table name] WHERE name != “Bob” AND [...]

Tags: ,

Các lệnh cơ bản của MySQL.

Written on 03/03/2010 – 10:07 | by hanh_bk |

Đây là những cái cóp nhặt được và những cái hay gặp trong quá trình làm việc, ghi lại để tiện theo dõi: To login (from unix shell) use -h only if needed. # [mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. mysql> create database [databasename]; List all databases [...]

Tags: ,
  • Search for:
  • Phản hồi gần đây

  • Tags Cloud