I am a novice...How do I move tables from one database/table to another database?
I have phpMyAdmin I figure I use that somehow.
| SitePoint Sponsor |


I am a novice...How do I move tables from one database/table to another database?
I have phpMyAdmin I figure I use that somehow.


phpmyadmin has an Export tab -- play with it
it will produce an sql text file which contains CREATE TABLE ("structure") and INSERT ("data") statements
just read that file into the SQL tab for the new database and run it
![]()


ok, playing was good.
my tables had a prefix of mos_ and it should be jos_ I now assume I can simple rename those?




vewwy Intewesting.
I tried that a couple of weeks ago and whilst it should have worked, it fell over on the loading order of the tables. Constraints meant that they had to be loaded in a more specific order. Unless ~ wouldn't be surprised ~ I may have made a mistake somewhere.
bazz


you can rename them after you create them in the target database, or alternatively you can text edit the sql file with search/replace after extracting from the source database
the neat thing about mysql as compared with other database systems is that the source code CREATE TABLE and INSERT statements is not a proprietary data format, but plain text and standard SQL -- you can even (with minor modification) use the SQL in a completely different database system
Bookmarks