Wishlist 0 ¥0.00

MYSQL数据库导入大数据量sql文件失败的解决方案

MYSQL数据库导入大数据量sql文件失败的解决方案

1.在讨论这个问题之前首先介绍一下什么是“大数据量sql文件”。

导出sql文件。

选择数据库-----右击选择“转储SQL文件”-----选择"结构和数据"  。保存文件db_mras.sql文件。

2.导入sql文件。在MYSQL中新建数据库db_mras。选择数据库-----右击选择“运行SQL文件”-----选择文件db_mras.sql,运行。

现在发现运行失败,提示错误“MySQL server has gone away” 。针对该问题提出如下解决方案:

提示该错误意思是:客户端与mysql的链接断开了,原因一般为sql运行时间过长或者sql文件太大。

排查问题原因:

(1)mysql服务宕了

运行命令:show  global status like  'uptime';    如果uptime的值很大 表明最近mysql服务没有重启。  若日志也没有相关信息,表明服务没有重启过,可以排除这个可能了。

(2)mysql链接超时

运行命令:show global variables  like '%timeout'; 查看运行结果中wait_timeout的值,一般为28800。代表mysql在误操作28800秒之后链接会关闭。

(3)mysql文件过大

运行命令:show global variables  like 'max_allowed_packet';   查看运行结果max_allowed_packet的值 ,如果过小,需要调整大。

解决方法:

在mysql的my.ini文件末尾加如下几句话: wait_timeout=2880000;     interactive_time=2880000;    max_allowed_packet=16M;  

其中max_allowed_packet代表控制其缓存区的最大长度。 wait_timeout代表无操作链接等待时间。

修改完以上参数之后重启mysql服务。

查看是否修改成功:运行命令:show global variables  like '%timeout';      show global variables  like 'max_allowed_packet';

  小贴士:如果找不到my.ini文件可以运行命令:mysql --help|grep my.ini 来查找文件路径。  

注意:如果以上办法没有解决你的问题,你还需要查看你的mysql文件安装盘的空间是否足够。

怎样使用MySQL-Front成功导入数据库文件?

  如何使用MySQL-Front导入数据库文件?当下载完MySQL-Front,很多人都会开始思索怎样在实际的工作中运用,mysql的一大运用就是在处理数据库上,那么今天跟大家讲讲如何成功利用MySQL-Front导入数据库文件?

  1、下载MySQL-Front(中文版)之后,解压后双击进行安装,只需直接下一步即可完成。

  2、双击桌面上MySQL-Front图标运行主程序,在信息栏输入服务器地址(例cd535.gotoip.net),如下图所示:

怎样使用MySQL-Front成功导入数据库文件?_数据库_mysql导入文件_课课家

  3、在连接栏同样输入服务器地址(例cd535.gotoip.net),其它选项默认即可,如下图所示:

  4、在注册栏输入数据库用户名、数据库密码、数据库名,如下图所示:

  5、确定数据库信息输入无误点击打开远程连接,右键数据库选择“输入”以及“SQL文件”图标,然后再从本地电脑选择需要导入的SQL文件即可,如下图所示:

  附:MySQL-Front导入SQL文件不受大小限制,另外还可以导入Access文件、Excel文件、ODBC表格。

  万一不能正常导入也可以得到相关错误提示,有助于进一步排查故障原因。

  另:MySQL数据库备份文件较小,也可通过phpMyAdmin管理工具进入后点击“Import”进行导入。

mysql8.0数据导入mysql5.7问题解决

本地数据库是mysql8.0,但是腾讯云云数据库是mysql5.7,在导入的时候提示了如下错误:

"Warning: Using a password on the command line interface can be insecure.?ERROR 1273 (HY000) at line 7819: Unknown collation: 'utf8mb4_0900_ai_ci'?dumper err?""-17")

这是因为腾讯云云数据库mysql5.7不支持utf8mb4_0900_ai_ci字符集,所以就把数据库打开,搜索utf8mb4_0900_ai_ci,然后批量替换成:utf8_general_ci,然后再导入就行了。

如果原来数据库格式是utf8mb4,而要导入的数据库不支持utf8mb4,那就再把utf8mb4批量改成utf8就行。

Upgrading from MySQL 5.7 to 8.0 on Windows

As you may know, I’m using MySQL exclusively on GNU/Linux. To be honest for me it’s almos 20 years that the year of Linux on the desktop happened. And I’m very happy with that.

But this week-end, I got a comment on an previous post about upgrading to MySQL 8.0, asking how to proceed on Windows. And in fact, I had no idea !

So I spent some time to install a Windows VM and for the very first time, MySQL on Windows !

The goal was to describe how to upgrade from MySQL 5.7 to MySQL 8.0.

So once MySQL 5.7 was installed (using MySQL Installer), I created some data using MySQL Shell:

Of course I used latest MySQL Shell, 8.0.18 in this case. Don’t forget that if you are using MySQL Shell or MySQL Router, you must always use the latest 8.0 version even with MySQL 5.7.

Before upgrading, I ran MySQL Upgrade Checker to be sure everything is compatible with MySQL 8.0:

No problem, I’m good to go !

Don’t forget, now it’s the right time to perform a backup or a snapshot.

The first step is to stop the MySQL Service:

When done, you have to launch once again the MySQL Installer and use Modify your MySQL 5.7 Server product features to only leave the Sever data files checked:

When all is proceeded, you return to the MySQL Installer Product Overview and you Add a new product:

We select the latest MySQL 8.0 and there is no need to select Server data files, as we will upgrade our current data:

When is done, please stop the new MySQL80 service and modify the my.ini (of MySQL 8.0!) that is located in System\ProgramData\MySQL\MySQL Server 8.0 by default:

In that file, we modify the actual value of datadir and we point it to where was located the datadir of MySQL 5.7. In this example I only used the default values:

And now it’s the most tricky part of the upgrade process, when you save this file, you must specified the ANSI encoding:

If you don’t use the right encoding, when you will start the MySQL Service, in the error log you will have a message like this: [ERROR] Found option without preceding group in config file ... at line 1

When saved, you can start the service. It will take some times as MySQL will proceed to the upgrade of the system tables and other files as you can see in the error log:

When the service is running again, you can connect and you should have access to all the data that was in you previous MySQL 5.7:

As you can see the test schema is there and of course we can check the content too:

I hope this post answers the questions of those that were experiencing issues when trying to perform an in-place upgrade from MySQL 5.7 to MySQL 8.0 in Microsoft Windows.

About Us

Since 1996, our company has been focusing on domain name registration, web hosting, server hosting, website construction, e-commerce and other Internet services, and constantly practicing the concept of "providing enterprise-level solutions and providing personalized service support". As a Dell Authorized Solution Provider, we also provide hardware product solutions associated with the company's services.
 

Contact Us

Address: No. 2, Jingwu Road, Zhengzhou City, Henan Province

Phone: 0086-371-63520088 

QQ:76257322

Website: 800188.com

E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.