出现缘由:

  1. 在workbench中操作删除了某选中数据库,
  2. 点击左上角第一个那个“+SQL”(create a new sql tab for executing queries )
  3. 打开.sql文件或者粘贴sql语句并执行
  4. 报错:Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar.
    MySQL Workbench执行sql语句报错Error Code: 1046. No database selected Select the default DB......

原因解释:
直译:错误代码:1046。未选择数据库通过在侧边栏的SCHEMAS列表中双击其名称,选择要使用的默认DB。
其实就是因为之前删除了选中的数据库,但是新Query进来前未选择一个默认数据库来操作数据

解决操作:

  1. 列表中双击需要操作的数据库
  2. 执行sql语句
  3. 成功,刷新一下就能看到选择的数据库中执行结果了
    MySQL Workbench执行sql语句报错Error Code: 1046. No database selected Select the default DB......
    MySQL Workbench执行sql语句报错Error Code: 1046. No database selected Select the default DB......

相关文章:

  • 2021-04-13
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2021-09-28
  • 2021-11-16
  • 2022-01-24
  • 2022-12-23
猜你喜欢
  • 2021-08-24
  • 2021-07-11
  • 2022-01-14
  • 2021-04-24
  • 2021-09-18
  • 2021-05-16
  • 2022-12-23
相关资源
相似解决方案