我正在尝试使用localhost将文本(.sql)文件加载到Windows 2008 R2上的MySQL数据库中,但是在数据库名称的第一个字母被截断时会出现奇怪的错误。我首先做'显示数据库'以确认我在并且字符串是正确的,然后更改到目标数据库,然后运行'加载E:\ MySQL \ rosedestinationlog.sql;
为避免任何歧义,我以root用户身份登录。
返回奇怪的错误1049,后跟缺少第一个字符的数据库的名称。如果我然后尝试做任何其他事情,例如再次运行'show databases',我会收到连接丢失的错误。退出CL并重新启动它允许我重新连接,但之后会出现相同的错误。
我已经向TCP的两个方向打开了端口3006。我可以提供一些其他文件,但其他人遇到了同样的错误。我可以在Mac上正常加载这些文件。下面是CL屏幕打印输出:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator> mysql -u root -p;
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 61
Server version: 5.5.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| akhf_beta |
| bank |
| mysql |
| performance_schema |
| rosecampdiary |
| rosedestinationlog |
| roseflightprep |
| ruredb |
| test |
+--------------------+
10 rows in set (0.00 sec)
mysql> use rosedestinationlog;
Database changed
mysql> source E:\MySQL\rosedestinationlog.sql;
ERROR:
Unknown command '\M'.
ERROR 1049 (42000): Unknown database 'osedestinationlog.sql;'
mysql> show databases;
No connection. Trying to reconnect...
ERROR 1049 (42000): Unknown database 'osedestinationlog.sql;'
ERROR:
Can't connect to the server
mysql>
答案 0 :(得分:0)
当你跑步时:
mysql> source E:\MySQL\rosedestinationlog.sql;
看起来反斜杠-M正被程序拾取。尝试将文件路径全部放在引号中,例如类似的东西:
mysql> source 'E:\MySQL\rosedestinationlog.sql';
答案 1 :(得分:0)
mysql> use rosedestinationlog < source "E:\MySQL\rosedestinationlog.sql";
如果您的源.sql
文件包含用于创建数据库'rosedestinationlog'
的语句
删除它并尝试它将工作。