我试图使用本地主机将一个文本(.sql)文件加载到Windows2008 R2上的MySQL数据库中,但遇到了一个奇怪的错误,数据库名称的第一个字母被截断了。我首先执行“显示数据库”来确认我在其中并且字符串是正确的,然后切换到目标数据库,然后运行“Load E:\MySQL\rosedestinationlog.sql;
为了避免任何歧义,我以root身份登录。
这将返回奇怪的错误1049,后跟缺少第一个字符的数据库名称。如果我随后尝试执行任何其他操作,例如再次运行“show database”,则会收到连接丢失的错误消息。退出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>发布于 2012-03-05 13:35:16
当你在运行时:
mysql> source E:\MySQL\rosedestinationlog.sql;看起来反斜杠-M正在被程序接受。尝试将文件路径全部用引号括起来,例如:
mysql> source 'E:\MySQL\rosedestinationlog.sql';发布于 2012-03-05 13:36:19
mysql> use rosedestinationlog < source "E:\MySQL\rosedestinationlog.sql";如果您的源.sql文件包含用于创建数据库'rosedestinationlog'的语句,请删除它并尝试使用它。
https://stackoverflow.com/questions/9562013
复制相似问题