MySQL Workbench executes sql statement and reports Error Code: 1046. No database selected Select the default DB......

Reason for appearance:

  1. Delete a selected database in the workbench operation,
  2. Click the first "+SQL" in the upper left corner (create a new sql tab for executing queries)
  3. Open the .sql file or paste the sql statement and execute
  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.
    Insert picture description here

Reason explanation:
Literal translation: Error code: 1046. Unselected database By double-clicking its name in the SCHEMAS list in the sidebar, select the default DB to be used.
In fact, it is because the selected database was deleted before, but a default database was not selected to manipulate the data before the new Query came in

Solution operation:

  1. Double-click the database to be operated in the list
  2. Execute sql statement
  3. Success, refresh it to see the execution result in the selected database
    Insert picture description here
    Insert picture description here

Guess you like

Origin blog.csdn.net/Mr_Bobcp/article/details/107249702