MySQL import problem


#1

I’m trying to install drupal on a domain.
I’ve established a MySQL database, user/pw.

I need to load the database with the drupal tables.

The file is at hostname/drupal/database/database.mysql

Using the command:

mysql -h hostname -u username -p pw dbname < hostname/drupal/database/database.mysql

fails with file not found. i’ve tried every other path i can think of, none work.

using the mysqlimport command fails with a permission error

Support has been excruciatingly slow and unhelpful.

The first tech obviously didn’t read my post before replying.

The second tech answered one of my questions, but hasn’t answered this one.

It’s pretty darned frustrating when you read all the various docs and end up with a question that can only be answered by a tech on the inside, and they’re too busy to fix your problem…


#2

The path to your script there looks funny to me – you only need a relative path there, like:
mysql -h hostname -u username -p pw dbname < database.mysql

Remember, even though your database is on a different server, you’re running the MySql query tool locally. It’s installed on your webhosting server (otherwise “mysql” wouldn’t be in your path to execute at all). The query tool makes a connection to the remote database, but it’ll assume the file you’re talking about is in your current working directory.


#3

Thanks for the post.

Unfortunately, I’ve wrung the changes of which path to use every which way I can imagine.

I either get file not found or access denied errors.

But I’m noting that lots of other folks have been having problems with data base access on machines after they’ve been updated, and accordingly long response lags from support.

Makes it hard to believe that folks can run production sites here…


#4

I’m not sure what your level of comfort is with Linux command-line, but it still sounds to me like you might be tangling with basic UNIX paths/permissions issues (which you’d hit on any server anywhere…). I did a similar import this morning without any problems.

Test #1: Is the file actually readable by your current user? Just type “more import.sql” (or whatever your filename is) to make sure you haven’t accidentally made it unreadable.

Test #2: Can you run MySql in interactive mode? Enter the same command without the “< import.sql” at the end, type your password when prompted, and try a basic command like “show tables;”. You can exit by typing “quit”. If this isn’t working then sort that out first.


#5

Thanks again for your post.

I am not at all comfortable with the command line (I hates it, I hates it) especially when it is rarely clear what the required syntax is, and one gets ALL these different suggestions, some which work here, others which work there. Not as much consistency as one might wish for…

Much time wasted experimenting and typing until enough of a pattern emerges.

I’ve definitely found some holes in the documentation, :wink: or lack thereof…

One of the problems was, as you suspected, that I needed to be in the working directory of the file I wanted uploaded. I don’t know why I couldn’t specify the path any other way, but…

The second involved user permissions, more precisely, the allowed hosts file.
That was the source of the annoying permission errors…

Those problems having been dealt with, the tables were imported without further problems.

Thanks for your help.