Koozali.org: home of the SME Server

How to import a mysql database ???

Offline jklapp

  • *
  • 32
  • +0/-0
How to import a mysql database ???
« on: March 09, 2008, 06:23:05 AM »
Hi :)

I'm trying to import a database into mysql through phpmyadmin and I'm getting an error "File could not be read" ... Is there another way to import this database?

Thanks :)

Offline brianr

  • *
  • 988
  • +2/-0
Re: How to import a mysql database ???
« Reply #1 on: March 09, 2008, 11:13:18 AM »
Sounds as if the file is corrupts OR the permission on it are not correct - please give us more information so that we can help you more...
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: How to import a mysql database ???
« Reply #2 on: March 09, 2008, 12:02:25 PM »
Hi :)

I'm trying to import a database into mysql through phpmyadmin and I'm getting an error "File could not be read" ... Is there another way to import this database?

Thanks :)
Yes, create the database using the mysqladmin command: http://wiki.contribs.org/MySQL#Create_a_new_database and after that import the database using the following syntax:
Code: [Select]
mysql databasename < /path/to/sql/file
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline jklapp

  • *
  • 32
  • +0/-0
Re: How to import a mysql database ???
« Reply #3 on: March 10, 2008, 01:35:42 AM »
Well, here are some details :)

First, I'm a long time windows user and I'm trying to learn SME... So please be forgiving toward my ignorance. :)

The SQL file was exported from a WinNT 4 server running mysql 3.23.53... The database is named sanctuary1... Now on the SME machine, Phpmyadmin says I have ALL PRIVILEGES and GRANT, but I get the error message "File could not be read" when trying to import the SQL file... Maybe the file is unreadable, or maybe there is a permission problem, I don't know.

I would like to upload the SQL file and run it from the SME machine directly, but I'm lost on the path commands... So I need help with what to type in. :)

Here is the location of the SQL file  (/ibays/sanctuary/files/sanctuary1.sql ) If I'm logged in as the "root" what should I type in?

Thanks :)

Offline jklapp

  • *
  • 32
  • +0/-0
Re: How to import a mysql database ???
« Reply #4 on: March 10, 2008, 06:59:07 AM »
Well, I figured out the path and now I know the problem is the SQL files. :(  One file got an error 1049 (unknown database) and another file got an error 1064 ( a syntax error near 'PK ' at line 1) Does that mean I'm doomed to use only Windows ?? :cry:

Offline brianr

  • *
  • 988
  • +2/-0
Re: How to import a mysql database ???
« Reply #5 on: March 10, 2008, 07:45:25 AM »
It sounds as though the file may have "windows" end of lines, not suitable for linux.  Get yourself a copy of something like textpad ( on the windows box), and load it up, then re-save it for Linux/Unix.
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: How to import a mysql database ???
« Reply #6 on: March 10, 2008, 09:02:12 AM »
Well, I figured out the path and now I know the problem is the SQL files. :(  One file got an error 1049 (unknown database)
You probably did not create the database like I suggested earlier or forgot to specify the database during import. Please re-read my instructions earlier and follow them to the letter. If you do not succeed post the output of the errors here and do not rephrase them.

and another file got an error 1064 ( a syntax error near 'PK ' at line 1) Does that mean I'm doomed to use only Windows ?? :cry:
Again post the error you are reported here to the letter and do not paraphrase, it might be a line ending error but I suspect some illegal syntax in your SQL file.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline jklapp

  • *
  • 32
  • +0/-0
Re: How to import a mysql database ???
« Reply #7 on: March 11, 2008, 05:11:57 AM »
I tried all the above and nothing seemed to work ... But then I logged into each newly created databases directly from mysql and ran this command line ( mysql> \. path/to/sql/file ) each database imported correctly, and I'm happy to report, without any problems. :)

Thank you for your help... I think I'm going to like SME :) ... Now let's see how hard the mail server is to setup. ;)


Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: How to import a mysql database ???
« Reply #8 on: March 11, 2008, 08:06:00 AM »
and ran this command line ( mysql> \. path/to/sql/file ) each database imported correctly, and I'm happy to report, without any problems. :)
That would mean an export. For an import you need to direct the other way (<) , so I guess you made a typo here.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline raem

  • *
  • 3,972
  • +4/-0
Re: How to import a mysql database ???
« Reply #9 on: March 11, 2008, 09:53:42 AM »
jklapp

Quote
... Now let's see how hard the mail server is to setup.

It's already set up, just add users and they automatically have email addresses like
user@yourdomain.com
and
user@yourvirtualdomain.com

You can further adjust this by adding specific user@domain email addresses into the Pseudonyms panel
eg
user3@myvirtualdomain1.com forwards to user3

 
...

Offline jklapp

  • *
  • 32
  • +0/-0
Re: How to import a mysql database ???
« Reply #10 on: March 11, 2008, 03:00:42 PM »
That would mean an export. For an import you need to direct the other way (<) , so I guess you made a typo here.

No typo... After I logged into the database in mysql, the prompt was "mysql>" and I just typed in "\. path/to/sql/file" :)

Offline jklapp

  • *
  • 32
  • +0/-0
Re: How to import a mysql database ???
« Reply #11 on: March 11, 2008, 03:03:58 PM »
jklapp

It's already set up, just add users and they automatically have email addresses like
user@yourdomain.com
and
user@yourvirtualdomain.com

You can further adjust this by adding specific user@domain email addresses into the Pseudonyms panel
eg
user3@myvirtualdomain1.com forwards to user3

 

That seems easy enough :) ... Does SME have a SMTP server?

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: How to import a mysql database ???
« Reply #12 on: March 11, 2008, 05:00:08 PM »

The SQL file was exported from a WinNT 4 server running mysql 3.23.53... The database is named sanctuary1... Now on the SME machine, Phpmyadmin says I have ALL PRIVILEGES and GRANT, but I get the error message "File could not be read" when trying to import the SQL file... Maybe the file is unreadable, or maybe there is a permission problem, I don't know.


Hi..

try to look at Heidisql.. is a windows client for mysql..

you can use it to transfer data from a server to another opening 2 connection at the same time..

you can even open the .sql file and import it.

HTH

ciao
Stefano

Offline raem

  • *
  • 3,972
  • +4/-0
Re: How to import a mysql database ???
« Reply #13 on: March 11, 2008, 05:50:53 PM »
jklapp

Quote
Does SME have a SMTP server?

Yes.
Have you read the manual(s), linked at the top of these forums, particularly chapter 13
http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter13

...

Offline jklapp

  • *
  • 32
  • +0/-0
Re: How to import a mysql database ???
« Reply #14 on: March 11, 2008, 09:22:45 PM »
jklapp

Yes.
Have you read the manual(s), linked at the top of these forums, particularly chapter 13
http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter13


Read the manuals???  lol ... Now that would make to much sence ;)