Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing to DB using phpMyAdmin 1

Status
Not open for further replies.

ITGL72

MIS
Jul 2, 2001
105
0
0
US
I have not been able to find documentation that helps me (novice) use the phpMyAdmin of my webhost to import a text file that was exported from a database, and import it into the MySQL database.

Any links you can recommend?

I guess if I know what the format of the default text file to be imported looked like that would help as long as the phpMyAdmin import screen is with its default settings.

Thanks!
 
This is how I have been doing it:

Export your other database information into one CSV(comma seperated variables) per table. Recreate each table in MySQL with phpMyAdmin. At the properties page of each table, click the link "Insert textfiles into table". The coresponing page will ask you for the location of the file for this table along with other questions about the file. Make sure you change the "Fields terminated by" to a "," instead of the default ";". The rest of the table is pretty self explanatory.

If you are looking at creating a full database (multiple tables, fields, and records) in one import, then you need to have your other database export the information into SQL statement which you can then run from the "Or Location of the textfile :" field of the database main page.

hope this helps :)
Hokey
 
It does!

Thanks! Its still a bit weird to me, and I know I'll have more questions. I'll try to keep it in this thread.

 


Is it possible that I may be able to import data to a DB from that screen, but only the appropriate fields?

Say for example the DB is formated like so:


ID, Field1, Field2, Field3, Field4


But I only want to import new data say to Field3, Field4 and let the ID just auto_increment.


I have been trying it, and not getting the best of success


I have been able to however import the entire table into the DB, but the fields have to match exactly with the existing fields in the DB or they go in out of order.

Did this make sense?
 
make sure the CSV file only contains the fields you want to import and then specify what fields your are importing in the last input box (Column names) on the "Insert textfiles into table".
 
Thanks, let me go try that out. What I did before was have a text file with ALL THE fields, then in the bottom section where you select columns I would designate the columns I wanted to import. That is where I was having trouble.

Let me go test, thanks!

 
I also have trouble importing comma limited text files that I exported from MS Access to MySQL using PHPMyAdmin. The problem is that when MS Access export data, it won't put quotes on Autonumbered ID field. So the data looks like this:

1,"Lisa","Cheney","lcheney@hotmail.com"
2,"Christine","Logan","clogan@hotmail.com"

After I import it to MySQL with PHPMyAdmin, the records are messed up. Any ideas on how to get around this? Thanks,

Lisa
 
On the insert textfiles screen did you check the "OPTIONALLY" box on the "Fields enclosed by" section?

checking the optionally box means that 'only char and varchar fields are enclosed by the "enclosed by"-character'
 
I spent a lot of time doing this and found that using mysqldump is much more reliable and efficiente. The following would copy TABLE_NAME from DB1_NAME on whatever host working from (the host you are entering commands on) into DB2_NAME on whatever host you specify:
Code:
c:\apache\mysql\bin>mysqldump --opt
Code:
DB1_NAME TABLE_NAME
Code:
| mysql --host=
Code:
YOUR_HOST
Code:
 -C -u
Code:
USERNAME
Code:
 -p
Code:
DB2_NAME
Code:
Enter password:
Code:
********

For example, if I wanted to backup my "user_profiles" table from my "MEMBERSHIPS_DB" database onto another server, assuming I had already created the database "MEMBERSHIPS_DB_backup" and had the right username (Admin) and password, I could use the following command to copy my table to the remote db:
Code:
c:\apache\mysql\bin>mysqldump --opt
Code:
MEMBERSHIPS_DB user_profiles
Code:
| mysql --host=
Code:
my-other-domain.com
Code:
 -C -u
Code:
Admin
Code:
 -p
Code:
MEMBERSHIPS_DB_backup
Code:
Enter password:
Code:
********
-gerrygerry
Go To
 
I'd like to thank gerrygerry.

I've been searching everywhere for an efficient way to import data from my development environment to my production environment with phpmyadmin.

Using mysqldump is BY FAR the best way. I had numerous problems imputing data with the insert textfile utility in phpmyadmin. mysqldump is definately the way to go.

thanks gerrygerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top