以下限制适用于在 Windows 上使用 MySQL 平台:The following restrictions apply to use of MySQL on the Windows platform:
进程内存Process memory
在 Windows 32 位平台上,默认情况下不可能在单个进程中使用超过 2GB 的 RAM,包括 MySQL。这是因为 Windows 32 位上的物理地址限制为 4GB,而 Windows 内的默认设置是将虚拟地址空间分割为内核 (2GB) 和用户/应用程序 (2GB)。On Windows 32-bit platforms, it is not possible by default to use more than 2GB of RAM within a single process, including MySQL. This is because the physical address limit on Windows 32-bit is 4GB and the default setting within Windows is to split the virtual address space between kernel (2GB) and user/applications (2GB).
某些版本的 Windows 具有启动时间设置,可通过减少内核应用程序来启用更大的应用程序。或者,要使用超过 2GB 的空间,请使用 64 位版本的 Windows。Some versions of Windows have a boot time setting to enable larger applications by reducing the kernel application. Alternatively, to use more than 2GB, use a 64-bit version of Windows.
文件系统别名File system aliases
使用
MyISAM表时,不能在 Windows 中使用别名链接到另一个卷上的数据文件,然后链接回主 MySQLdatadir位置。When usingMyISAMtables, you cannot use aliases within Windows link to the data files on another volume and then link back to the main MySQLdatadirlocation.此工具通常用于将数据和索引文件移动到 RAID 或其他快速解决方案。This facility is often used to move the data and index files to a RAID or other fast solution.
端口数量有限Limited number of ports
Windows 系统大约有 4000 个可供客户端连接的端口,端口上的连接关闭后,需要两到四分钟才能重新使用该端口。在客户端以高速率连接到服务器和从服务器断开连接的情况下,在关闭的端口再次可用之前,所有可用端口可能会被用完。如果发生这种情况,MySQL 服务器即使正在运行,也会显得无响应。端口也可能被计算机上运行的其他应用程序使用,在这种情况下,MySQL 可用的端口数量会减少。Windows systems have about 4,000 ports available for client connections, and after a connection on a port closes, it takes two to four minutes before the port can be reused. In situations where clients connect to and disconnect from the server at a high rate, it is possible for all available ports to be used up before closed ports become available again. If this happens, the MySQL server appears to be unresponsive even though it is running. Ports may be used by other applications running on the machine as well, in which case the number of ports available to MySQL is lower.
有关此问题的详细信息,请参阅 https://support.microsoft.com/kb/196271。For more information about this problem, see https://support.microsoft.com/kb/196271.
DATA DIRECTORY和INDEX DIRECTORYDATA DIRECTORYandINDEX DIRECTORYWindows 支持
CREATE TABLE语句的DATA DIRECTORY子句仅适用于InnoDB表,如第 17.6.1.2 节“从外部创建表” 中所述。对于MyISAM和其他存储引擎,DATA DIRECTORY的INDEX DIRECTORY和CREATE TABLE子句在 Windows 和具有非功能性的任何其他平台上将被忽略。realpath()调用。TheDATA DIRECTORYclause of theCREATE TABLEstatement is supported on Windows forInnoDBtables only, as described in Section 17.6.1.2, “Creating Tables Externally”. ForMyISAMand other storage engines, theDATA DIRECTORYandINDEX DIRECTORYclauses forCREATE TABLEare ignored on Windows and any other platforms with a nonfunctionalrealpath()call.您无法删除其他会话正在使用的数据库。You cannot drop a database that is in use by another session.
不区分大小写的名称Case-insensitive names
文件名在 Windows 上不区分大小写,因此 MySQL 数据库和表名称在 Windows 上也不区分大小写。唯一的限制是在整个给定语句中必须使用相同的大小写来指定数据库和表名称。请参阅第 11.2.3 节“标识符区分大小写”。File names are not case-sensitive on Windows, so MySQL database and table names are also not case-sensitive on Windows. The only restriction is that database and table names must be specified using the same case throughout a given statement. See Section 11.2.3, “Identifier Case Sensitivity”.
目录和文件名Directory and file names
在 Windows 上,MySQL Server 仅支持与当前 ANSI 代码兼容的目录和文件名页。例如,以下日语目录名在西方语言环境(代码页 1252)中不起作用:On Windows, MySQL Server supports only directory and file names that are compatible with the current ANSI code pages. For example, the following Japanese directory name does not work in the Western locale (code page 1252):
datadir="C:/私たちのプロジェクトのデータ"
同样的限制也适用于 SQL 语句中引用的目录和文件名,例如
LOAD DATA中的数据文件路径名。The same limitation applies to directory and file names referred to in SQL statements, such as the data file path name inLOAD DATA.\路径名分隔符The\path name separator character路径名称组件由
\字符分隔,该字符也是 MySQL 中的转义字符。如果您使用LOAD DATA或SELECT ... INTO OUTFILE,请使用带有/字符:Path name components in Windows are separated by the\character, which is also the escape character in MySQL. If you are usingLOAD DATAorSELECT ... INTO OUTFILE, use Unix-style file names with/characters:mysql>
LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;mysql>SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;或者,您必须将
\字符加倍:Alternatively, you must double the\character:mysql>
LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;mysql>SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;管道问题Problems with pipes
管道无法在 Windows 命令行提示符下可靠地工作。如果管道包含字符
^Z/CHAR(24),Windows 会认为已遇到文件结尾并中止程序。Pipes do not work reliably from the Windows command-line prompt. If the pipe includes the character^Z/CHAR(24), Windows thinks that it has encountered end-of-file and aborts the program.这主要是当您尝试应用二进制日志时出现的问题,如下所示:This is mainly a problem when you try to apply a binary log as follows:
C:\>
mysqlbinlogbinary_log_file| mysql --user=root如果您在应用日志时遇到问题并怀疑是由于
^Z/CHAR(24)字符,您可以使用以下解决方法:If you have a problem applying the log and suspect that it is because of a^Z/CHAR(24)character, you can use the following workaround:C:\>
mysqlbinlogC:\>binary_log_file--result-file=/tmp/bin.sqlmysql --user=root --execute "source /tmp/bin.sql"后一个命令还可用于可靠地读取可能包含二进制数据的任何 SQL 文件。The latter command also can be used to reliably read any SQL file that may contain binary data.