Skip to main content
gamedev.net
🔒 Locked

[web] SQL File Redirection

Started by Sonnenblume 0 replies 300+ views
Original Post
Sonnenblume
Sonnenblume
Hi there I got tired of having to create tables within my database by hand, so Ive tried to give file redirection a go. Basically ive got a Database called books (which ive already created) and an sql file called booktable.sql. My aim is to use the contents of booktable.sql to create and update the tables rather than have to do it all by entering everything by hand using the command line mysql. The file booktable.sql is currently in the 'bin' directory along with the mysql exe, and I have tried the following commands..... \. booktable.sql (returned the message : ERROR : Failed to open the file 'booktable.sql', error 2 AND mysql -u USERNAME -d books -p < booktable.sql (returned the error message the system cannot find the file specified) Do you guys have any suggestions?
konForce
konForce
Quote:
The file booktable.sql is currently in the 'bin' directory along with the mysql exe, and I have tried the following commands.....
mysql -u USERNAME -D books -p < booktable.sql

You don't need to put the SQL file in the bin folder. It's relative to where you are when you run the command. Thus, if you are in /home/me and the file is /home/me/booktable.sql the above command would work.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.