mysql not in报错_MySQL 8 导入报错:'ascii' codec can't decode byte 0xd2 in position 26: ordinal not in rang...

系统环境

Windows 10

MySQL Server 8.0.12

MySQL Workbench 8.0.12

现象

从另一台开发机上导出的数据库备份,无法在本机导入,MySQL Workbench 报错

21:37:49 Restoring D:\geo2.sql

Error executing task: 'ascii' codec can't decode byte 0xd2 in position 26: ordinal not in range(128)

Error executing task [Error 32] : 'c:\\users\\\xd2\xbc\xd2\xbb\\appdata\\local\\temp\\tmpjx4rq_.cnf'

21:37:50 Import of D:\geo2.sql has finished

导出的机器 (WSL 下的 MySQL),Workbench 导出时也是报类似的错误,无奈使用 MySQL 命令行导出的 SQL 文件。

解决方法

还是命令行靠谱。

> cd /mnt/d/

> mysql --host=127.0.0.1 --user=root --password

mysql > use geo2;

mysql > source geo2.sql;

在 WSL 下就可以成功导入。

WSL 下使用 MySQL Client 连接 Win10 上安装的 MySQL

> mysql -uroot -p

Enter password:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

需要指定 HOST

> mysql --host=127.0.0.1 --user=root --password

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 22

Server version: 8.0.12 MySQL Community Server - GPL

rank 在 mysql 8 中变成了保留关键字

在新环境中,有一行 SQL 一直报错

order by rank desc

看了半天猜测 rank 是关键词,果然

order by `rank` desc

改成这样就好了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值