首页 > 解决方案 > 在 ubuntu 和 python 中对 foodmart_mysql.sql 文件执行查询

问题描述

我正在尝试在 Ubuntu 的命令行中对 foodmart 数据库执行查询,或者在 python 中更好地执行查询,如果可能的话:

http://pentaho.dlpage.phi-integration.com/mondrian/mysql-foodmart-database

我试过mysql -uroot -p <foodmart_mysql.sql了,我得到了ERROR 1046 (3D000) at line 22: No database selected。我搜索了这个错误,发现我需要检查文件中的“USE databsename or something like this in thesql USE”file and make sure that it is not there. However, there is not any命令。

我感谢任何帮助或评论。

谢谢, 阿夫辛

标签: mysqlsql

解决方案


看起来你要恢复一些.sql文件。

这是命令行中的代码:

mysql -u UsernameHere -p YourPasswordHere dbnamehere < "D:\sample.sql"

在此之前,首先找到你的 mysql 的目录,例如:

cd C:\Program Files (x86)\MySQL\MySQL Server 6.0\bin

确保 mysql.exe 位于此目录。

然后输入上面的代码。

祝你好运


推荐阅读