I came across a somewhat strange thing. I run my queries from the file name in windows
like source c:\sql\general.sql but this does not work
mysql> source c:\sql\general.sql -------------- mysql Ver 14.14 Distrib 5.6.11, for Win32 (x86) Connection id: 6 Current database: joins Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.6.11 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: 5 days 2 hours 53 min 45 sec Threads: 1 Questions: 167 Slow queries: 0 Opens: 86 Flush tables: 1 Open ta bles: 62 Queries per second avg: 0.000 -------------- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sourc ec:ql' at line 1 ->
This request
CREATE TABLE mytable ( id INT NOT NULL AUTO_INCREMENT, name varchar(50) NOT NULL, PRIMARY KEY (id) );
However, when I try to run the same query, but this time I will name my file stuff.sql
mysql> source c:\sql\stuff.sql Query OK, 0 rows affected (0.65 sec)
Is this a common mistake?
Update
source c:\sql\\general.sql creates this error
mysql> source c:\sql\\general.sql -------------- mysql Ver 14.14 Distrib 5.6.11, for Win32 (x86) Connection id: 6 Current database: joins Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.6.11 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: 5 days 3 hours 42 min 4 sec Threads: 1 Questions: 192 Slow queries: 0 Opens: 97 Flush tables: 1 Open ta bles: 62 Queries per second avg: 0.000 -------------- ERROR: Unknown command '\\'. -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sourc ec:ql\\general.sql' at line 1 mysql>
source share