Reputation: 1434
I am trying to execute a query on the foodmart database in command line on Ubuntu, or better in python, if possible:
http://pentaho.dlpage.phi-integration.com/mondrian/mysql-foodmart-database
I tried mysql -uroot -p <foodmart_mysql.sql
and I got ERROR 1046 (3D000) at line 22: No database selected
. I searched for this error and I found that I need to check for 'USE databsenameor something like this in the
sqlfile and make sure that it is not there. However, there is not any
USE` command in the file.
I appreciate any help or comment.
Thanks, Afshin
Upvotes: 1
Views: 244
Reputation: 611
You have not mentioned the database name in the command. Use this command
mysql -u root database_name < foodmart_mysql.sql -p
Upvotes: 0
Reputation: 4211
It seems like you are going to Restore some .sql
file.
Here's the code in your command line:
mysql -u UsernameHere -p YourPasswordHere dbnamehere < "D:\sample.sql"
Before that locate the directory of your mysql first something like:
cd C:\Program Files (x86)\MySQL\MySQL Server 6.0\bin
Make sure that this directory the mysql.exe is located.
then input the code above.
Good luck
Upvotes: 1