Due to work reasons, it is often not possible to achieve full onlineization (that is, all data is completed online and no import or export is required), and exporting to Excel is often slower than practicing to become an immortal. Therefore, when we export database files to local use, we often use the method of exporting to CSV format. The csv format also often has problems such as garbled Chinese characters or skipped lines when exported, which puts you in a dilemma. Your boss wants data, but you can’t export it, which is frustrating. 1. Problem: We originally wanted to export the data in the database as shown in the left picture to its original appearance, but it became a mess on the right; 2. Solution: a: Export to csv the same way as before; b: Select the csv file you exported, right-click and select [Notepad] to open it; c: File-->Save As-->Encoding select UTF-8-->Save; (The file name and save type do not need to be changed. After clicking Save, it will prompt that the file already exists. Do you want to replace it? Just select [Yes]) d: Open the file you just saved, but this time choose to open it in Excel, and then the data will be clean, just like in your database (as shown below). Supplementary knowledge: MySQL backup -- import and export -- and solve the garbled problem 1. Export the entire database mysqldump -u username -p database name > exported file name
2. Export a table mysqldump -u username -p database name table name > exported file name
3. Export a database structure
-d no data --add-drop-table add a drop table before each create statement 4. Import the database 1) Restore from file to database
For example: restore from test.sql to database db1
2) Use the common source command to enter the MySQL database console. For example, mysql -u root -p mysql>use database and then use the source command The following parameters are script files (such as .sql used here)
5. Solve the problem of garbled export For example:
Then you should also use --default-character-set=utf8 when importing data:
After unified encoding, the garbled characters problem in MySQL data migration is solved. The above article on how to quickly solve the problem of garbled characters and skipped lines in mysql exported scv files 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:
|
<<: Detailed analysis and usage of tcpdump command under Linux
>>: Vue binding object, array data cannot be dynamically rendered case detailed explanation
Question 1: How do you instruct the browser to dis...
First, let’s take a look at the general practices...
Table of contents Where is the source code of the...
Basic syntax The use of text-overflow requires th...
Sprites: In the past, each image resource was an ...
Table of contents 1. Introduction 2. Main text 2....
Preface NFS (Network File System) means network f...
First of all, let me talk to you about my daily l...
High CPU load caused by MySQL This afternoon, I d...
An application of CSS animation, with the same co...
This article example shares the specific code of ...
Overview There are many open source network monit...
1. overflow:hidden overflow hidden If overflow:hi...
My first server program I'm currently learnin...
Table of contents first step: The second step is ...