mysql - 在 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 the
sql USE”file and make sure that it is not there. However, there is not any
命令。
我感谢任何帮助或评论。
谢谢, 阿夫辛
解决方案
看起来你要恢复一些.sql
文件。
这是命令行中的代码:
mysql -u UsernameHere -p YourPasswordHere dbnamehere < "D:\sample.sql"
在此之前,首先找到你的 mysql 的目录,例如:
cd C:\Program Files (x86)\MySQL\MySQL Server 6.0\bin
确保 mysql.exe 位于此目录。
然后输入上面的代码。
祝你好运
推荐阅读
- tensorflow - 使用 Tensorflow keras loss=tf.losses.sparse_softmax_cross_entropy 时的奇怪准确度指标
- reactjs - 如何将移动手势(例如触摸和滑动)添加到 React Bootstrap 轮播组件?
- vba - 字符串值未正确传递
- jquery - jQuery在加载下一页后执行,不是当前的
- php - 检查是否返回以前的状态,以便用户可以再次借书
- html - 在科尔多瓦上使用视口的正确方法
- vb.net - 参数@gender 没有默认值
- vb.net - 如何仅通过 sql 查询在记录集中保存一个长计算字符串?
- java - 线程“main”java.lang.IllegalArgumentException 中的异常:JobListener 名称不能为空
- java - 编译具有依赖关系的类时遇到问题