Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4991

Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4993
Question 9: How do you execute a script file? – MySQL Question of the Day

Skip to content

By urs in mysql questions

 
The script.sql file was created like below:
 
echo select * from tt.table1 > script.sql
 
How do you execute the script?
 
(Find all correct answers)

a) mysqlexe -p -u root -f script.sql
b) mysql -p -u root < script.sql
c) mysql -p -u root -e "source script.sql"

 
[ The mysql Client Program (10%) - Using Script Files with MySQL ]
 

Tags: , ,

Comment Feed

2 Responses


  1. Answers:

    b c

    A tool called ‘mysqlexe‘ does not exist.

  2. Addendum:

    The command line
    echo select * from tt.table1 > script.sql
    is valid for Windows systems.

    Quotes should be added on Unix systems:
    echo "select * from tt.table1" > script.sql

    Even if script.sql were not containing valid SQL commands, it would not make any difference to the answers. Thanks to Anonymous.

You must be logged in to post a comment.