MySQL Forums
Forum List  »  MySQL Query Browser

source command through mysql query browser
Posted by: mukesh kurkure
Date: July 08, 2009 04:49AM

I've been away from MySQL for a while, but I don't recall seeing anything like this before. The SOURCE command, to execute one script from inside another, works fine if I'm using the command-line MySQL, but it gives a syntax error when I try to run it in the Query Browser.

Here's a sample script:

DROP DATABASE IF EXISTS my_random_db;
CREATE DATABASE my_random_db;
USE my_random_db;

SOURCE /home/pgranger/db/scripts/CREATE_ALL.sql;
SOURCE /home/pgranger/db/grants/dev.sql;

This runs just fine if I use MySQL from the command line, but if I try executing any script containing the SOURCE command in the browser, I get an error like:

Error while execeuting query: SOURCE /home/pgranger/db/scripts/CREATE_ALL.sql:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SOURCE /home/pgranger/source/db/scripts/CREATE_ALL.sql' at line 1 (errno: 1064)

It's also notable that all the other keywords (DROP, CREATE, USE, IF, EXISTS) are shown in blue, and SOURCE is normal black text. Looks like the parser in the Query Browser doesn't recognize it as a keyword.

Is this some sort of safety feature, to keep scripts from executing other scripts inside the query browser? Any known way around it?

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
source command through mysql query browser
July 08, 2009 04:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.