Can't load local file into mysql database
So I will preface this by saying that I'm not all that skilled in MySQL (or regular SQL for that matter), but I'm trying to load data from a .txt file into my table that I keep for ticket sales. When I do that using:
LOAD DATA LOCAL INFILE '/path/presales1.txt' INTO TABLE presales
I get the '>
prompter. And I have no idea what to do. I tried looking up solutions and the one I thought would work was:
--local-infile[=1];
because that is straight out the MySQL handbook. It didn't work (nor did any variation on it...such as local-infile=1;
, local-infile=1
etc....)
Did I miss a simple step? My version of MySQL is 5.7
mysql mysql-5.7
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
So I will preface this by saying that I'm not all that skilled in MySQL (or regular SQL for that matter), but I'm trying to load data from a .txt file into my table that I keep for ticket sales. When I do that using:
LOAD DATA LOCAL INFILE '/path/presales1.txt' INTO TABLE presales
I get the '>
prompter. And I have no idea what to do. I tried looking up solutions and the one I thought would work was:
--local-infile[=1];
because that is straight out the MySQL handbook. It didn't work (nor did any variation on it...such as local-infile=1;
, local-infile=1
etc....)
Did I miss a simple step? My version of MySQL is 5.7
mysql mysql-5.7
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
So I will preface this by saying that I'm not all that skilled in MySQL (or regular SQL for that matter), but I'm trying to load data from a .txt file into my table that I keep for ticket sales. When I do that using:
LOAD DATA LOCAL INFILE '/path/presales1.txt' INTO TABLE presales
I get the '>
prompter. And I have no idea what to do. I tried looking up solutions and the one I thought would work was:
--local-infile[=1];
because that is straight out the MySQL handbook. It didn't work (nor did any variation on it...such as local-infile=1;
, local-infile=1
etc....)
Did I miss a simple step? My version of MySQL is 5.7
mysql mysql-5.7
So I will preface this by saying that I'm not all that skilled in MySQL (or regular SQL for that matter), but I'm trying to load data from a .txt file into my table that I keep for ticket sales. When I do that using:
LOAD DATA LOCAL INFILE '/path/presales1.txt' INTO TABLE presales
I get the '>
prompter. And I have no idea what to do. I tried looking up solutions and the one I thought would work was:
--local-infile[=1];
because that is straight out the MySQL handbook. It didn't work (nor did any variation on it...such as local-infile=1;
, local-infile=1
etc....)
Did I miss a simple step? My version of MySQL is 5.7
mysql mysql-5.7
mysql mysql-5.7
asked Feb 4 '17 at 1:59
Adam McGurkAdam McGurk
1234
1234
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Watch carefully, everything is up my sleeve.
mysql> SELECT 'abc
'>
'>
'> def';
+-----------+
| abc
def |
+-----------+
| abc
def |
+-----------+
1 row in set (0.00 sec)
Notice that my first line has a quote, but not the matching quote. When I hit return; it prompted me with '>
-- That's the clue that I need to balance the quotes. Eventually, I did so, and the query terminated.
Look around, I suspect there is a stray quote on the preceding or following line. Or the quotes around the filename aren't really the same.
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br />INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.
– Adam McGurk
Feb 4 '17 at 2:34
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f163204%2fcant-load-local-file-into-mysql-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Watch carefully, everything is up my sleeve.
mysql> SELECT 'abc
'>
'>
'> def';
+-----------+
| abc
def |
+-----------+
| abc
def |
+-----------+
1 row in set (0.00 sec)
Notice that my first line has a quote, but not the matching quote. When I hit return; it prompted me with '>
-- That's the clue that I need to balance the quotes. Eventually, I did so, and the query terminated.
Look around, I suspect there is a stray quote on the preceding or following line. Or the quotes around the filename aren't really the same.
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br />INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.
– Adam McGurk
Feb 4 '17 at 2:34
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
add a comment |
Watch carefully, everything is up my sleeve.
mysql> SELECT 'abc
'>
'>
'> def';
+-----------+
| abc
def |
+-----------+
| abc
def |
+-----------+
1 row in set (0.00 sec)
Notice that my first line has a quote, but not the matching quote. When I hit return; it prompted me with '>
-- That's the clue that I need to balance the quotes. Eventually, I did so, and the query terminated.
Look around, I suspect there is a stray quote on the preceding or following line. Or the quotes around the filename aren't really the same.
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br />INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.
– Adam McGurk
Feb 4 '17 at 2:34
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
add a comment |
Watch carefully, everything is up my sleeve.
mysql> SELECT 'abc
'>
'>
'> def';
+-----------+
| abc
def |
+-----------+
| abc
def |
+-----------+
1 row in set (0.00 sec)
Notice that my first line has a quote, but not the matching quote. When I hit return; it prompted me with '>
-- That's the clue that I need to balance the quotes. Eventually, I did so, and the query terminated.
Look around, I suspect there is a stray quote on the preceding or following line. Or the quotes around the filename aren't really the same.
Watch carefully, everything is up my sleeve.
mysql> SELECT 'abc
'>
'>
'> def';
+-----------+
| abc
def |
+-----------+
| abc
def |
+-----------+
1 row in set (0.00 sec)
Notice that my first line has a quote, but not the matching quote. When I hit return; it prompted me with '>
-- That's the clue that I need to balance the quotes. Eventually, I did so, and the query terminated.
Look around, I suspect there is a stray quote on the preceding or following line. Or the quotes around the filename aren't really the same.
answered Feb 4 '17 at 2:24
Rick JamesRick James
41.9k22258
41.9k22258
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br />INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.
– Adam McGurk
Feb 4 '17 at 2:34
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
add a comment |
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br />INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.
– Adam McGurk
Feb 4 '17 at 2:34
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />
LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br /> INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.– Adam McGurk
Feb 4 '17 at 2:34
OK....so I figured you were referring to syntax (not sure syntactically what I did wrong still) and separated my commands like this: <br />
LOAD DATA LOCAL INFILE '/path/presales1.txt'
<br /> INTO TABLE presales;
<br /> And no longer got the prompt. Instead, it terminated with a file/path does not exist error....even though I know the path is true because all I did was copy it straight from Windows Explorer. So I still have the issue, just different error message.– Adam McGurk
Feb 4 '17 at 2:34
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
Either turn backslashes into forward, or double them up.
– Rick James
Feb 4 '17 at 4:43
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f163204%2fcant-load-local-file-into-mysql-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown