MySQL question

They have: 26 posts

Joined: Nov 2001

Just installed php/apache/mysql in order to start learning, but am not sure how to 'import' a mysql database. im using phpmyadmin which allows me to create a database ie give it a name, but how would i import a downloaded database into this?

the next screen gives me options to create tables which is fine for a new database but i have one as part of a tutorial, so would rather use this than recreate from scratch. have looked thru the mysql info but cannot find an answer.

the tutorial refers to using commands in mysql.exe but i just get errors doing this, very confused...

or can i connect to the database another way?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you're using PhpMyAdmin, you can choose on the same screen as the create a table, to import a database from a text file. Most databases stored as text files end in .sql (so whatever.sql).

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I've never imported a database that was not originally dumped from mysql.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Ah! I have! lol... From excel, from perl flat files, et cetera. PhpMyAdmin really does a fine job of it. If you're not working from a dumped database (with the tables intact), you will need to recreate the tables, setting them properly, THEN import the data.

What sort of data do you have?

druagord's picture

He has: 335 posts

Joined: May 2003

if it commes from another mysql server you can simply copy the folder databasename from your data directory to the new one don't forget to set the permissions

IF , ELSE , WHILE isn't that what life is all about

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.