Quickly solve the problems of incorrect format, slow import and data loss when importing data from MySQL

Quickly solve the problems of incorrect format, slow import and data loss when importing data from MySQL

If you want to solve the slow problem once and for all, you might as well upgrade your MySQL to MySQL 8.0. The default character set of MySQL 8.0 has been changed from latin1 to utf8mb4, so now UTF8 is much faster, and the speed is increased by 1800% in certain queries!

But if time doesn’t wait, use the following method to quickly solve the problem.

Problem 1: Incorrect format (often the time format is incorrect);

Method 1: Save the excel file as csv and then import it into the database;

Method 2: In the first step of importing, the default encoding is 65001 (UTF-8). You can try to select [10008 (MAC - Simplified Chinese GB 2312)] or [Current Windows Codepage]. These are three common encodings. Try several times and you will always find an encoding format that matches your computer.

Method 3: In the last few steps of the import, you can set the type of the time column to datetime or time. In short, try to choose the type of the data. The default is varchar.

Problem 2: Slow import (due to large amount of data, please wait for it to finish importing);

Method 1: If the data is imported to you by someone else (whether it is a SQL file, a CSV file, or an Excel file), you will import it very slowly. The import speed is generally: SQL file>CSV file>Excel file. Then ask him to direct it for you again. No matter how he directed it before, please ask him to follow the steps below to redirect it again:

Open the table you want to export - there is an export button in the upper right corner of the opened table - use this export button;

Note: The [Export] mentioned above is different from the [Export Wizard] in the options of right-clicking a table. The table exported using the [Export Wizard] is sometimes slower, so I usually use the [Export] in the upper right corner to export data.

Problem 3: Data loss (generally, data loss occurs when using Excel);

Method 1: Save Excel as csv and then import;

Method 2: There may be a column with a large amount of data in the original data. For example, the last column of the grade table may be the teacher's comments, and there are too many comments in this column, which exceeds the default limit of MySQL for a single package (usually 255). Therefore, in the last step of the import, change the type of the comment column to text and the length to 65535. 65535 is the maximum length of the text type. If you can't remember it in daily life, just fill in 60000, which is basically enough and easy to remember.

Method 3: If data is lost during export, you may have selected "Excel Spreadsheet". Find the export method that suits you according to the figure below.

But if the above methods do not cover the problem you want to solve, then did you encounter a problem when exporting data from MySQL? You may want to take a look at the article below.

Quickly solve the problem of garbled characters and jump lines in mysql exported scv files

The above article on how to quickly solve the problems of incorrect format, slow import and data loss when importing data into MySQL is all the content that the editor shares with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Why is there such a big difference between Oracle and MySQL data import?
  • MySQL 4 methods to import data
  • Examples of importing and exporting MySQL table data
  • MySQL database account creation, authorization, data export and import operation examples
  • Java implements batch import of .csv files into mysql database
  • How to import Excel files into MySQL database
  • HeidiSQL tool to export and import MySQL data
  • Navicat imports csv data into mysql
  • MySQL database migration quickly exports and imports large amounts of data
  • How to quickly import data into MySQL

<<:  Vue binding object, array data cannot be dynamically rendered case detailed explanation

>>:  Solution to the problem that Vue binding objects and array variables cannot be rendered after changing

Recommend

Docker runs operations with specified memory

as follows: -m, --memory Memory limit, the format...

Getting Started Tutorial for Beginners ④: How to bind subdirectories

To understand what this means, we must first know ...

Java+Tomcat environment deployment and installation process diagram

Next, I will install Java+Tomcat on Centos7. Ther...

Implementing a simple student information management system based on VUE

Table of contents 1. Main functions 2. Implementa...

Some notes on installing fastdfs image in docker

1. Prepare the Docker environment 2. Search for f...

WeChat applet realizes multi-line text scrolling effect

This article example shares the specific code for...

A simple and in-depth study of async and await in JavaScript

Table of contents 1. Introduction 2. Detailed exp...

Vue implements the magnifying glass effect of tab switching

This article example shares the specific code of ...

Analysis of the HTML writing style and reasons of experienced people

1. Navigation: Unordered List vs. Other Label Ele...

Solution to JS out-of-precision number problem

The most understandable explanation of the accura...

Detailed explanation of custom events of Vue components

Table of contents Summarize <template> <...

Analysis of the cause of docker error Exited (1) 4 minutes ago

Docker error 1. Check the cause docker logs nexus...