Attempted CSV import from my local drive into MySql

I tried to copy a .csv file for import to my MySQL instance and manage to cause this issue.

Commands run:

  1. railway login

  2. railway run ls /var/lib/mysql-files/

  3. railway run sudo cp ~/Downloads/Parts.csv /var/lib/mysql-files/Parts.csv

  4. (in mysql console):

  LOAD DATA INFILE '/var/lib/mysql-files/Parts.csv'
    INTO TABLE parts
    FIELDS TERMINATED BY ','
    ENCLOSED BY '"'
    LINES TERMINATED BY '\n'
    IGNORE 1 LINES;
  1. railway up

Not sure how this creates a Docker issue, but maybe this will help you.

Nick

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

19 Replies

a year ago

Are you aware that railway run runs the given command locally? Railway does not provide a way to run commands on the service via ssh or anything similar.


"Are you aware that railway run runs the given command locally? Railway does not provide a way to run commands on the service via ssh or anything similar."Well, I got a peek into /var/lib/mysql-files/ on railway, so I don't know how to answer your question. Somehow I got in there.


a year ago

I honestly have no clue what you've done, I just needed to correct the assumption that railway run runs commands on the remote before you messed something up locally.


Honestly, I don't either. Not sure how it affected not only the MySQL db I was working on, but when I spun up a 2nd MySQL database, I got the exact same error message. On my second attempt, I was not using the railway CLI, so it may be an issue with the template itself.


a year ago

It's unlikely to be an issue with the template.


You're right, I haven't; my bad! Here's the error:

[FATAL tini (7)] exec docker-entrypoint.sh failed: No such file or directory

Attachments


a year ago

Are you getting this error from a freshly deployed MySQL database?


No. I'm getting different errors for a fresh one.


Here's the errors I got from a new fresh instance (MySQL-HP80 in the pic), if you're interested.

Attachments


a year ago

Please note red does not always mean there was an error, you should take into account the contents of the log to determine if the log is an error.What I think happened is you did railway up while linked to the database service, I would advice you to check the help printout for the railway cli because I don't think railway up does what you think it does either.


Good points, all and I'll have to read the docs again to make sure I understand. But I somehow managed to break two MySQL with the 5 steps I posted at the start of this thread. It's the same on other projects, not just this one (I have a 3rd fresh MySQL that's DOA).Here's a screenshot of the Test Connection failing in the Data tab:

Attachments


a year ago

TL;DR unless you really really know what you are doing you are never supposed to run railway up while linked to a database service, as you did.


Oh, it's that simple, is it? Awesome. Thankfully, the only data I had in there was logs, so not a big loss. Thanks for the suggestion. Learned something new.


a year ago

From what you did, it would be highly unlikely for you to lose your data, after rolling back you data will be there again.


Cool. I'll assume that it's the Redeploy button under one of the Deployments > History, right?


a year ago

Yeah if there is no rollback a redeploy will do it too.


Yup, rolling back to the original template deploy (non-CLIs) worked fine. Looks like all my tables are there, too. Thanks.


a year ago

No problem!


a year ago

If you want to load in a CSV file, do it with a GUI tool like dbgate.


Attempted CSV import from my local drive into MySql - Railway Help Station