简体   繁体   中英

phpMyAdmin export and import views

I'm exporting a database created by somebody else, that contains some views, but the exported SQL will later on (on import) create a table and not a view.

CODE:

DROP VIEW IF EXISTS `listado_sorteos`;
CREATE TABLE IF NOT EXISTS `listado_sorteos` (
`idsorteo` int(10) unsigned
,`fecha_alta` datetime
,`idaplicacion` int(10) unsigned
,`fecha_sorteo` datetime
,`descripcion` varchar(45)
);

In my opinion that's not right, because it creates a table and not a view... but am I right? If not, what solution do I have to export views from within phpMyAdmin?

I m having the same problem, and resolved through the following solution. To export view first of all we need to convert it an table and we can export that table as easily. To convert a view to table by

create table table-name select * from view-name

I'm having a similar problem. when i export the whole database, the sql dump contains code to create the views, then further code to create tables with the same data as the views. the result means i cant import the dump without error.

my current workaround is to un-select the names of the views from the list of tables to export. this exports the database without the views. i then click on each view and click export. i can then re-import the main dump, followed by each view (which i could paste into the main dump sql if i really wanted)

hope someone comes up with a better answer

OK - i've resolved this for my situation. reading the PMA bugs pages, it turns out there was a bug in the export routine for the old version of PMA that i was using.

Solution: Update PMA. (Quite simple, check your MySQL and PHP are compatibe, get the latest version and copy the files across to your existing phpMyAdmin folder. resart if you like).

I also found PMA was not exporting views properly. Recently, I decided to export only the tables using PMA. To my surprise, both the tables and views were exported perfectly. Not happy with a one-off accident, I did it again and again everything was exported perfectly. I haven't a clue why this happens, but one should never question a gift feature.

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