total dweeb/noob MySQL question

Status
Not open for further replies.

razorboy

Underworld Overlord
Oct 4, 2007
39
0
0
just learning my way around MySQL. trying to do a small database upload. basically i punching in a few lines manually, downloaded it and am now trying to re upload it, but i get this

Attempting this through cpanel and Mysql admin

QL query: LOAD DATA INFILE './tmp/phpXsl7cW' INTO TABLE `Jokes` FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n'
MySQL said:
#1045 - Access denied for user 'xxxxxxx'@'%' (using password: YES)

I have no clue as to what is going on.
Berate me if you must, but please lend a thought........

Josh
 


sorry that is what i have been using. for some reason the upload just wont work
 
From the MySQL manual:

For security reasons, when reading text files located on the server, the files must either reside in the database directory or be readable by all. Also, to use LOAD DATA INFILE on server files, you must have the FILE privilege. See Section 5.7.3, “Privileges Provided by MySQL”.
You're host may not have given you this privilege on your database, hence the permissions error. Also, if this is a shared hosting environment and the file you are sourcing is in your home directory, you probably need to use LOAD DATA LOCAL INFILE and use an absolute path instead of a relative one. The relative path will be relative to the directory your control panel is executing in, not your home directory.

Just out of curiosity, is there a reason you're doing it this way? Do you plan on importing a very large delimeted data set or are you just trying to figure out how to get data in MySQL in general? You said you're new but I'm not sure how new you are, most of the time you would want to use the INSERT statement.

Say you have the following lines in a file called import.sql
Code:
INSERT INTO TABLE foo ( column1, column2 ) VALUES ("foo", "bar");
INSERT INTO TABLE foo ( column1, column2 ) VALUES ("baz", "bam");
this would correspond to a delimited file such as:

column1, column2
foo, bar,
baz,bam

Then you can execute all of those statements like...

Code:
mysql -u username -p database-name < import.sql
or PHPMyAdmin can probably run a text file of SQL statements as well, I don't generally use MySQL front ends so I'm not sure.

If you know all that, my bad... just wasn't sure how "new" you are.
 
Status
Not open for further replies.