简体   繁体   中英

Import/export data in phpmyadmin

I have a db on my localhost. I also have the same db on live hosting which I need to update. For example, I have a table1 and table2. In table1 I added new column "price":null, in table2 I added few rows with data. Live tables may be more up-to-dated then local ones and may contain more I need to make a dump file to update my live db:

  1. for table1: only the structure,
  2. for table2: only the data.

How can I do it with phpmyadmin? I'm afraid to lost the date because of flag "drop table/create table". Without this flag it cause error "table already exists"

you can do these:

1) Remove these drop table codes from your dump file:

DROP TABLE IF EXISTS `table1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;

2) Add "IF NOT EXISTS" to your Create statement so that it does not re-create table1 if table1 exists.

CREATE TABLE IF NOT EXISTS `table1` {
...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM