Loading Schemata From *.sql Files Into MySQL
I have recently been working a lot with MySQL stored procedures. I tend to write them up first in a text editor - textpad or vim, and then import them into MySQL for testing etc. I have always cut and then pasted the code into the command line - how archaic!!! There must, and is a better way to import *.sql files into MySQL without having to cut and paste schemata in such a poor way - MySQL’s SOURCE command. For importing my_file.sql from your /home directory simply type:
mysql> SOURCE /home/my_file.sql
Hopefully this entry will serve to remind me in the future!
As an addendum, it is strange that the SOURCE command is not documented in MySQL’s online documentation - see this search with google. Also the command line help turns nothing up…
mysql> HELP SOURCE;
Nothing found Please try to run 'help contents' for a list of all accessible topics
Strange…
About this entry
You’re currently reading “ Loading Schemata From *.sql Files Into MySQL ,” an entry on chris ramsay
- Published:
- 9.30.06 / 8am
- Category:
- MySQL, Programming










No comments
Jump to comment form | comments rss [?] | trackback uri [?]