November 2nd, 2000, 04:22 AM
I want to execute .sql files in mySQL. Is there any similar commands to Oracle's run or @? Kindly help me
November 2nd, 2000, 05:21 AM
The only way I've found of executing a SQL script in MySQL is to pass it in as standard input when starting the mysql client. So, to run mydml.sql, do:
mysql -uusername -ppassword <mydml.sql
This is something of a crap solution as you can't invoke a SQL script from within the client, so I figure there must be a better answer out there, but I'm buggered if I can find it.
November 2nd, 2000, 08:18 AM
That's pretty much the correct way to do it, but you have to pass the database to use, also, unless it's created in your .sql file...
mysql -uuser -ppass database < file.sql