1、假如sql文件为test.sql,在C盘根目录下。C:\test.sql 2、进入mysql后,执行如下命令: mysql> source c:\test.sql 3、截图如下所示。 Enter password: ******* Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 5.0.18-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> source c:\test.sql
mysql -u root -p12345 testdb <test.sql 能不能将执行的结果 重定向到文件中??
打开文件看内容的办法的确不可行。 如果文件属于G级别的。打开会把内存耗费完的。 建议用LINUX 下的 head 和 tail 命令查看开头和结尾。这样就能大概判断里面是什么东西了。
这个是恢复整个数据库的
你的.sql里是什么
show tables ; 是空的。
@mysql -u root -p123456 --execute="create database teleconf_dba" mysql use teleconf_dba;mysql -u root -p398300 teleconf_dba <d:\teleconf_db.sql;
第二 执行 mysql -u user -p teleconf_dba <d:\teleconf_db.sql (这里没有分号)
回车以后输入你的 密码 就OK了你说的没有数据是你没有恢复成功
那并不是恢复成功了!!!!
C:\>mysql -u root -p fdb <d:\fdb.sql
Enter password: *****C:\>
这样才是成功
如果进去了 \q 退出来
然后执行C:\> mysql -u root -p teleconf_dba <d:\teleconf_db.sql
Enter password: *****
1楼的方法不会显示执行的进程。
最好是进入到MYSQL的SHELL中,这样倒入过程中出现的警告或者错误都可以显示出来。
然后执行命令SOURCE 你的SQL文件 或者\. 你的SQL文件.
SQL文件尽量放到/tmp目录下,要不然会出现 13号错误。
2、进入mysql后,执行如下命令: mysql> source c:\test.sql
3、截图如下所示。
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.18-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> source c:\test.sql
能不能将执行的结果 重定向到文件中??
如果文件属于G级别的。打开会把内存耗费完的。
建议用LINUX 下的
head 和 tail 命令查看开头和结尾。这样就能大概判断里面是什么东西了。