我对SQL很新,实际上昨天刚开始。我跟随的书要求我从他们提供的文本文件中运行sql语句。但是,我收到一条错误消息,我不明白为什么。以下是我输入的命令以及错误消息:
mysql> use bank;
Database changed
mysql> source c:\sql\LearningSQLExample.sql;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 9
Current database: bank
--------------
mysql Ver 14.14 Distrib 5.6.12, for Win64 (x86_64)
Connection id: 9
Current database: bank
Current user: lrngsql@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.6.12 MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: cp850
Conn. characterset: cp850
TCP port: 3306
Uptime: 1 day 4 hours 9 min 17 sec
Threads: 1 Questions: 6474 Slow queries: 1 Opens: 111 F
tables: 79 Queries per second avg: 0.063
--------------
ERROR:
Unknown command '\L'.
ERROR:
Failed to open file 'c:ql\LearningSQLExample.sql', error: 2
感谢您的帮助。
答案 0 :(得分:1)
你需要逃避反斜杠。输入source c:\\sql\\LearningSQLExample.sql;
答案 1 :(得分:0)
对于较新版本的mySQL命令行,只是一个额外的解决方案
将LearningSQLExample.sql
文件重命名为包含下划线的文件。
比如s_s.sql然后在命令行尝试
source c:/temp/s_s.sql;