PDA

View Full Version : importing tables, usernames


rbradscott
7-11-05, 09:36 AM
I've accidently created a new mySQL database "on top of" an old one. Using phpMyAdmin, I can view the desired "old" tables within this merged DB, approx 12 of 'em. I can see where I can export selected tables.

But, how/where do I "import" the tables I save, back into the correct database? I can't seem to find an import feature.

Also, I was careful with my DB creation, but now realize I did have identical usernames for two of my three unique DB's.

So
DB1, had SQL user: Name1
DB2, had SQL user: Name2
DB3, had SQL user: Name1

DB1 is now..... "screwed up", with tables combined from what was DB1, with the new DB3 tables.

Could this odd "merging" have been a result of my usage of an identical username for both DB1 and DB3? All three databases had/have unique names.

Pig
7-11-05, 09:59 AM
That's a pretty vague explanation. You cannot create databases on top of other databases, nor can you create duplicate users. Perhaps you did a dump into the wrong database. If you can be more clear in exactly what you did, and what you are trying to do now, we might be able to help you.

rbradscott
7-11-05, 10:36 AM
That's a pretty vague explanation. Hey, I tried to make it clear enough, please forgive me.You cannot create databases on top of other databases Work with me here - it was a figure of speech, that's why I put it in quotes; I still don't know exactly what went wrong, I'm trying to not only correct the current problem, but understand exactly how it got this way, nor can you create duplicate users. Perhaps you did a dump into the wrong database. If you can be more clear in exactly what you did, and what you are trying to do now, we might be able to help you.

I didn't do any "dumps". I carefully enough (or so I thought) renamed my 3rd, unused DB, and spent a few days working with it - it's running SMF. Then today when I went to access the photogallery, I got a DB access failure page.

Clearly, my 3rd DB usage (the SMF one), overwrote or inserted it's data into the 1st DB being currently used for the photo gallery. I don't yet know how, although that answer is less important that simply correcting the current misconfig's/problem. The current situation is perfectly evident by viewing the current table listings for each DB in phpMyAdmin. I can see the 1st DB contains 13 tables from the original photogallery install, and then many more from the message board install.

In addition, I assure you, my screen this morning, showed a Username1 in two different databases. It may be possible that PW's OPS is showing something incorrect, but I had the exact same username in two differently named databases.

Perhaps it is possible, if the two DB's in question, are running on different servers. Which is the case for my current three databases - the 1st one created runs on mysql07.powweb.com, the 2nd and 3rd ones on mysql10.powweb.com.

Regardless, I still can't find an "import table(s)" function in phyMyAdmin. Anyone? Bueller, Bueller...?

rbradscott
7-11-05, 10:48 AM
For the record, I may have found a way to manually insert text into each table, one at a time.

From phpMyAdmin, I selected the database name on the left index, which displays all tables immediately beneath. Then I selected the first table, and on the right pane, at the very bottom, is a link labeled "Insert data from a textfile into table". I think you're viewing the Structure tab, by default.

What I was really looking for, was a way to import and overwrite 13 tables in one single move. I can export all the desired table data (for 13 tables) with ease, from the desired DB.

But I'd still really like to find the same feature for importing the same tables into a different DB, all in one move.

rbradscott
7-11-05, 11:18 AM
Welp, that failed miserably. I was able to export table data from one DB and import it into another DB, but the DB with the imported data was not happy with it, even though it was created by the same PHP photo gallery package to begin with.

rbradscott
7-11-05, 12:43 PM
Solution was actually a very careful RTFM for phpMyAdmin, exporting/importing. I was importing wrong. I must admit, unless you have a decent grasp on mySQL to begin with, you can find yourself worse-off using phpMyAdmin, as, in my opinion, it's hardly intuitive.

https://phpmyadmin.powweb.com/Documentation.html

See, "backup" and "restore" sections.


[6.5] How can I restore (upload) my database or table using a dump? How can I run a ".sql" file.

Click on a database name in the left frame, the properties will be local displayed. Then in the "Run SQL query" section, type in your dump filename, or use the Browse button. Then click Go.


Choose database on left, choose SQL tab on right, look for Or
Location of the textfile: Choose your table file, click GO. Got no errors for 13 table files, and I exported them using the default settings.

The confusing part, for me at least, was that (it appears that) phpMyAdmin isn't actually just uploading a file, as is. It's actually "running" each file (through mySQL of course), as a real SQL query, which then imports/adds the data into the existing table selected.

Using the defaults on the export process worked fine, so it doesn't seem to be a concern about the checkboxes in the Structure and Data areas of the export interface

jealouz
8-2-05, 03:29 PM
rbradscott, i'm two weeks old user of Powweb, still a lot to learn. and MySQL is the first one that makes me crazy having problems on how to import .sql files too! Wow! THanks for the post! I made it! Cool!