数据库一直这样显示是为什么?

Microsoft Windows [版本 10.0.18363.1379]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\WINDOWS\system32>cd C:\Users\Lenovo\Desktop

C:\Users\Lenovo\Desktop>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.17 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source example.sql
ERROR:
Failed to open file 'example.sql', error: 2
mysql> source example.sql
ERROR:
Failed to open file 'example.sql', error: 2
mysql> source example.sql;
ERROR:
Failed to open file 'example.sql', error: 2

source example.sql

需要加完整路径,即example.sql所在的目录路径,比如在E盘中的话

source E:\example.sql

另外一点,需要确认下这个sql文件中有没有选择DB,如果没有写的话,可以先use下DB

您好,我是问答小助手,你的问题已经有小伙伴为您解答了问题,您看下是否解决了您的问题。

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~