Home Database Mysql Tutorial MySQL恢复和UTF文件BOM标志读取问题

MySQL恢复和UTF文件BOM标志读取问题

Jun 07, 2016 pm 05:02 PM
mysql number

MySQL最终恢复却都没用到这些,呵呵。今天客户又打电话过来,问我怎么样了,我交流以后发现,他还是按我说的备份了全部的MySQL安

前天,,客户来电说GPS巡线系统的后台数据库挂了,原因是原来分配给图片存储磁盘的空间不够了,他调整了一下分区。我让他把整个MySQL目录的文件备份下来(后来发现这是多么重要),然后重装一下数据库试试。重装以后发现不行。于是给我让他发了MySQL下面的data目录文件给我,还有今年二月份用后台软件备份下来的数据备份也发了过来。

网上查询发现MySQL的数据存储在data目录下的ibdata1文件中,使用UE打开该文件,发现全是0,显然不能包含数据,对比公司内部测试使用的MySQL服务器,确认该文件用于存储数据库数据。看来只能是使用二月份的备份数据了。

打开二月份备份数据,发现数据库的字符集用的是binary,这是当时不太清楚字符集该怎么设,从别人那里继承来的。试图重装一个MySQL,设定为binary,恢复还是有错误。在MySQL命令行中手动执行恢复操作,提示是数据库字段宽度不够,手动调整数据库字段大小,成功走完恢复过程,但是恢复出来的数据显示是乱码。

用UE打开备份文件,发现前面是FEFF,UTF的编码标记,后面是有规律的一个字节数据,一个字节的零,手动提取字节数据,恢复出来时可读的,于是想利用程序提取出来非零数据,然后恢复。结果,发现程序死活不能读到标记字节FEFF。想可能VC2008+Win7可能自动给你处理了FEFF,于是上VMWare+DOS622+TC2,结果还是一样,查到网上有一篇文章How NOT to skip BOM info (FF FE) when using fread or ifstream? 这个现象一摸一样。就是没有解答。

早晨又想到一个方法,利用文件传输,这下该啥码都出来了吧,于是上串口互联,一个串口打开串口调试软件,另一个串口copy,发现接收出来数据不对,MODE命令设之,发现收到的数据和UE的还是不一样啊。对比利用EMEditor二进制打开的文件,却发现串口接收的和EMEditor的一样。对比EMEditor的字节数和文件属性字节数,一致。验证C程序,一致。用EMEditor给文件加上UTF编码标记,C程序读取,可以读取到BOM数据。最后验证UE中间做了手脚,天啊。哎,太相信UE了。

MySQL最终恢复却都没用到这些,呵呵。今天客户又打电话过来,问我怎么样了,我交流以后发现,他还是按我说的备份了全部的MySQL安装目录,还有,他提到其他盘有一个ibdata1文件,时间太长了,我都忘了,应该是当时我为了数据安全,安装的时候将数据文件放到别的分区中了。这下好了,分析客户发过来的全部资料,清楚了原来安装MySQL的原始结构,并且发现原来的MySQL配置文件的MySQL自动备份存在MySQL目录中。于是就超级简单了。停止MySQL服务,移掉MySQL相关目录,解压客户发过来的数据到MySQL安装目录中,修改配置文件,在相应的路径中放置ibdata1,重启服务,OK,一切正常。

想想,Linux系的软件还是好啊,恢复起来赶紧利落。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

The latest news APP ranking recommendation in the currency circle (authoritative release in 2025) The latest news APP ranking recommendation in the currency circle (authoritative release in 2025) Apr 21, 2025 pm 09:33 PM

The best cryptocurrency trading and analysis platforms include: 1. OKX: the world's number one in trading volume, supports multiple transactions, provides AI market analysis and on-chain data monitoring. 2. Binance: The world's largest exchange, providing in-depth market conditions and new currency first-time offerings. 3. Sesame Open Door: Known for spot trading and OTC channels, it provides automated trading strategies. 4. CoinMarketCap: an authoritative market data platform, covering 20,000 currencies. 5. CoinGecko: Known for community sentiment analysis, it provides DeFi and NFT trend monitoring. 6. Non-small account: a domestic market platform, providing analysis of linkage between A-shares and currency markets. 7. On-chain Finance: Focus on blockchain news and update in-depth reports every day. 8. Golden Finance: 24 small

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

Top 10 Digital Virtual Currency Apps Rankings: Top 10 Digital Currency Exchanges in Currency Circle Trading Top 10 Digital Virtual Currency Apps Rankings: Top 10 Digital Currency Exchanges in Currency Circle Trading Apr 22, 2025 pm 03:00 PM

The top ten digital virtual currency apps are: 1. OKX, 2. Binance, 3. gate.io, 4. Coinbase, 5. Kraken, 6. Huobi, 7. KuCoin, 8. Bitfinex, 9. Bitstamp, 10. Poloniex. These exchanges are selected based on factors such as transaction volume, user experience and security, and all provide a variety of digital currency trading services and an efficient trading experience.

SQL vs. MySQL: Clarifying the Relationship Between the Two SQL vs. MySQL: Clarifying the Relationship Between the Two Apr 24, 2025 am 12:02 AM

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

How to safely store JavaScript objects containing functions and regular expressions to a database and restore? How to safely store JavaScript objects containing functions and regular expressions to a database and restore? Apr 19, 2025 pm 11:09 PM

Safely handle functions and regular expressions in JSON In front-end development, JavaScript is often required...

MySQL: The Database, phpMyAdmin: The Management Interface MySQL: The Database, phpMyAdmin: The Management Interface Apr 29, 2025 am 12:44 AM

MySQL and phpMyAdmin can be effectively managed through the following steps: 1. Create and delete database: Just click in phpMyAdmin to complete. 2. Manage tables: You can create tables, modify structures, and add indexes. 3. Data operation: Supports inserting, updating, deleting data and executing SQL queries. 4. Import and export data: Supports SQL, CSV, XML and other formats. 5. Optimization and monitoring: Use the OPTIMIZETABLE command to optimize tables and use query analyzers and monitoring tools to solve performance problems.

See all articles