在“Ctrl-C”行1恢复MysqlDump时出现语法错误

时间:2022-06-16 22:44:29

I'm using linux and i've tried both

我正在使用linux,我已经试过了

mysql -u root -pabc123 < ~/Desktop/restore.sql

mysql -u root -pabc123 < ~/Desktop/restore.sql

and while logged in as root to mysql

同时作为root用户登录到mysql

\. ~/Desktop/restore.sql

\。~ /桌面/ restore.sql

I keep getting the error You have an error in your SQl syntax; check the manual that corresponds to your MYSQL server version for the right syntan to use near 'Ctrl-C' at line 1

我不断地得到错误你的SQl语法有错误;检查与MYSQL服务器版本对应的手册,找到在第1行“Ctrl-C”附近使用的正确syntan

this is driving me bananas, does anybody have any idea why?

这让我抓狂,有人知道为什么吗?

This is a mysqldump --all-databases file

这是一个mysqldump——全数据库文件

Thanks!

谢谢!

here is the first few lines

这是前几行

-- MySQL dump 10.13  Distrib 5.1.58, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: 
-- ------------------------------------------------------
-- Server version   5.1.58-1ubuntu1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `mytmpDB`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `

3 个解决方案

#1


2  

mysql -u root -pabc123 < sed -e 's/^C//g' ~/Desktop/restore.sql

#2


0  

I had same problem too. When I changed a command mysqldump

我也有同样的问题。当我更改命令mysqldump时

mysqldump -u root db_name

,mysqldump - u root db_name

to

mysqldump -u root db_name > db_name.sql

mysqldump -u root db_name > db_name.sql。

it works at restoreing mysqldump.

它用于恢复mysqldump。

#3


0  

you can try to change your login user?

您可以尝试更改登录用户吗?

maybe the user when you create database is not the same as the user you backup your database ?

当您创建数据库时,用户可能与您备份数据库的用户不一样?

I have the same problem too.

我也有同样的问题。

you can try

你可以试着

sudo -u username -i

sudo - u用户名我

and do the same operation , Good Luck!

做同样的操作,祝你好运!

#1


2  

mysql -u root -pabc123 < sed -e 's/^C//g' ~/Desktop/restore.sql

#2


0  

I had same problem too. When I changed a command mysqldump

我也有同样的问题。当我更改命令mysqldump时

mysqldump -u root db_name

,mysqldump - u root db_name

to

mysqldump -u root db_name > db_name.sql

mysqldump -u root db_name > db_name.sql。

it works at restoreing mysqldump.

它用于恢复mysqldump。

#3


0  

you can try to change your login user?

您可以尝试更改登录用户吗?

maybe the user when you create database is not the same as the user you backup your database ?

当您创建数据库时,用户可能与您备份数据库的用户不一样?

I have the same problem too.

我也有同样的问题。

you can try

你可以试着

sudo -u username -i

sudo - u用户名我

and do the same operation , Good Luck!

做同样的操作,祝你好运!