mysqldump Backup, restore database path name contains whitespace processing methods (such as: Program Files)

Source: Internet
Author: User

Although the following methods can be solved, but the simplest direct, or directly before and after the path of the double quotation marks-"", this method is simple and effective.


The first thing to note is where mysqldump.exe is not important, it is important to handle illegal characters in the path.

For example: The location of my mysqldump.exe in the local

C: 6. 0\webapps\ui\web-inf\data\test

Direct invocation is definitely not possible because there are spaces in the path.
The solution is to replace the space with

C:/progra~1/apache~1/tomcat~1. 0/webapps/ui/web-inf/data/mau

The way.

Here are two things:
1. Program Files, Apache software Foundation
The first six letters, like this one, can be added "to".
2, Tomcat 6.0, Tomcattomcat 6.0, Tom 6.0, to 6.0
This needs to be retained ". 0", eventually replaced by tomcat~1.0, tomcat~1.0, tom6~1.0, to6~1.0
You can see the rules at a glance.

The final processing results are as follows:

C:/progra~1/apache~1/tomcat~1. 0/webapps/ui/web-inf/data/Test/mysqldump.exe ...

In fact, the above is the so-called DOS 8.3 format file name specification.

The so-called 8.3 format short file name specification, is the type such as progra~1 (directory) or Element week ~1.exe (file) such name--

"8" means the file name or the main part of the directory name is less than or equal to 8 bytes;

"3" means that the filename has an extension portion less than or equal to 3 bytes.

Another point is that the valid characters for the 8.3 file name do not include special characters such as spaces.

8.3 Short name format specification is the legacy of the dos+fat12/fat16 era, since WINDOWS95 began (in fact, it is said that starting from Windows for Groups 3.11), Windows has been able to support long filenames, but for forward compatibility, In particular, file system compatibility, the FAT file system enforces the feature "short file names that provide 8.3 compatible formats for long filenames."

So you'll see that on the Fat16/32 file system: The directory "program Files" also has a short name of "Progra~1" with a 8.3 specification, while the file "periodic table. exe" also has a short name of "Element week ~1.exe". [This is a little bit like the Hardlink under UNIX systems, an object that has two references. ]

PS: Know why the main program of IE browser is called iexplore.exe instead of Iexplorer? is to take care of 8.3 short-name specifications.

===================ntfs file system compatibility with the 8.3 format specification ===================

The NTFS file system supports Unicode (UTF16) Character set filenames, up to 255 UTF16 characters, Therefore, the NTFS file system and the Unicode character set-based 32-bit NT kernel Windows operating system itself do not necessarily follow the 16-bit DOS ERA Legacy 8.3 format short file name specification.

However, for compatibility, the NTFS file system also provides an optional feature: 8.3 compatible format. This feature in Windows is on by default, meaning that whenever a long file name object is created, the NTFS drive module of the system automatically creates a suitable 8.3-format short name to point to the object.

It should be noted that this feature is not enforced as it is in the FAT file system, so different disk utilities or operating systems may have different execution modes-

For example, the windowsxp can be closed with fsutil behavior set disable8dot3 1 command, the driver module closes this feature will not be added each time an additional short name, so that in new/rename a large number of small files/ Directory can slightly increase the disk write speed, (do not calculate a suitable short name, and do not have to write this additional information to disk).

================= non-Win32 standard old program Compatibility Dependent 8.3 specification =================

However, turning off this feature may cause some old-fashioned applications to have compatibility problems, which are "Windows applications" of the 32-bit GUI interface, but do not fully follow the specifications of the Win32 program, but are typically mixed with 16-bit APIs that use 8.3 short names to refer to files. Obviously, if you don't provide short names for long filenames at all on an NTFS partition, these 16/32-bit hybrid old programs will not be able to find files in the 8.3 format short name, of course, error ... But things are not always so simple--

Recently I found that there are several old applications that do not start normally, which includes the Kejida dictionary (main program Ncce_win.exe), which has been very popular on the campus network of Hkust. Fine-check the cause, it seems that only the NTFS partition will be a problem, moved to the FAT32 USB stick. Later, I was surprised to find: the U disk Gecheng NTFS and put on this program is no problem! ...... ......

A few hours later, the real reason was found, said very complex, in short: The whole path has a directory is not compatible with the short file name format, so the main program cannot find the relevant files!

Why is there a one-level directory incompatible with the 8.3 specification?

Because my hard drive is new after the failure of the previous hard drive, I changed it on a 64-bit Windows operating system to read one by one of the old hard drive on the same page. And that 64-bit Windows turned off the NTFS 8.3 compatibility feature, the copied directories and files do not have an additional short name, especially the E:\program files\ directory where I put the application. (64-bit Windows theoretically does not support both the 16-bit and 16/32-bit hybrid programs, so the NTFS-driven 8.3 compatibility may be turned off by default, or perhaps the optimizer shuts down.) )

Then I recovered the system partition with Ghost, The restored 32-bit WinXP does not turn off 8.3 compatibility, but the key issue is that the directory and files that have been written to the NTFS partition (without the short name) will not be rebuilt by this 32-bit XP short file name, the system will only append the new file or directory with 8.3 filenames, as for the previously established directories and files, even if the rename operation I can't "remind" XP to check and append a short file name--which makes me baffled.

So, when I put the software in E:\program files\ subdirectory, although the subdirectory "Technology dictionary", and Ncce_win.exe and other file names conform to the 8.3 specification, but there is a "program files" on the whole path is not in conformity with the 8.3 specification, and there is no equivalent short name substitution, so an API can not be used "e:\progra~1\ Technology dictionary \xxxxxxxx.xxx" location files, this program is of course not start normally.

-----------------------some of the commands related to 8.3 compatible names-----------------------

fsutil behavior Query DISABLE8DOT3 Check if the NTFS driver turns on the 8.3 compatibility feature

fsutil behavior set disable8dot3 1 off 8.3 compatibility features

fsutil behavior Set DISABLE8DOT3 0 turn on 8.3 compatibility features

fsutil file setshortname <longname> <8.3name> manually specify a 8.3 short name

dir/x lists subdirectories and files for the current directory, and corresponding 8.3 compatible names (if any)

---------------------------------------------------------------------------------------------------------

Windows shuts down and turns on short file name features:

Opens the registry, found: Hklm\system\currentcontrolset\control\filesystem

Set the value of NtfsDisable8dot3NameCreation to 1, that is, the short name is not created, meaning the following:

0 NTFS creates short file names. This setting enables applications the cannot process long file names and computers that use different code pages to find The files.

1 NTFS does not the create short file names. Although this setting increases the file performance, applications that cannot process long file names and computers the use Different code pages might not being able to find the files.

---------------------------------------------------------------------------------------------------------

GetShortPathName get long file name corresponding to the 8.3 format of the short file name when Windows entered the long file name era, so the DOS era of 8.3 format files are not used, But sometimes the 8.3 format file name is useful, for example, when a Word file name has a space, to use the shell to open Word files, Word will be the file name of the space cut off, resulting in the file Open will fail, the solution is to use GetShortPathName long file name to convert to short name. For example: GetShortPathName (L "C:\\Documents and Settings\\All Users", Szout, sizeof (szout)); return c:\docume~1\alluse~1

Specific instructions in: http://technet.microsoft.com/en-us/library/cc959352.aspx

mysqldump Backup, restore database path name contains whitespace processing methods (such as: Program Files)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.