BluRayCD Forum

 找回密码
 立即注册【分享大片】
查看: 739|回复: 0
收起左侧

[空间技术] windows7/2008 64位系统配置mysql64位免安装版的方法

[复制链接]

410

主题

177

回帖

1万

积分

Forum CEO

金币
2571 枚
体力
12349 点
kmxmxy 发表于 2011-7-18 09:14:09 | 显示全部楼层 |阅读模式
1、官方网站下载mysql-noinstall-5.6.2-winx64.zip
2、解压到E:\Program Files\MySQL.(路径自己指定)
3、在E:\Program Files\MySQL下新建my.ini配置文件,内容如下:

*****************配置文件开始*********************
  1. # MySQL Server Instance Configuration File
  2. # ----------------------------------------------------------------------
  3. # Generated by the MySQL Server Instance Configuration Wizard
  4. #
  5. #
  6. # Installation Instructions
  7. # ----------------------------------------------------------------------
  8. #
  9. #
  10. # CLIENT SECTION
  11. # ----------------------------------------------------------------------
  12. #
  13. # The following options will be read by MySQL client applications.
  14. # Note that only client applications shipped by MySQL are guaranteed
  15. # to read this section. If you want your own MySQL client program to
  16. # honor these values, you need to specify it as an option during the
  17. # MySQL client library initialization.
  18. #
  19. [client]

  20. port=3306

  21. [mysql]

  22. default-character-set=gbk

  23. # SERVER SECTION
  24. # ----------------------------------------------------------------------
  25. #
  26. # The following options will be read by the MySQL Server. Make sure that
  27. # you have installed the server correctly (see above) so it reads this
  28. # file.
  29. #
  30. [mysqld]

  31. # The TCP/IP Port the MySQL Server will listen on
  32. port=3306


  33. #Path to installation directory. All paths are usually resolved relative to this.
  34. basedir="E:\Program Files\MySQL"

  35. #Path to the database root
  36. datadir="E:\Program Files\MySQL\Data"

  37. [WinMySQLadmin]
  38. Server="E:\Program Files\MySQL\bin\mysqld.exe"

  39. # The default character set that will be used when a new schema or table is
  40. # created and no character set is defined
  41. default-character-set=gbk

  42. # The default storage engine that will be used when create new tables when
  43. default-storage-engine=INNODB

  44. # Set the SQL mode to strict
  45. sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

  46. # The maximum amount of concurrent sessions the MySQL server will
  47. # allow. One of these connections will be reserved for a user with
  48. # SUPER privileges to allow the administrator to login even if the
  49. # connection limit has been reached.
  50. max_connections=100

  51. # Query cache is used to cache SELECT results and later return them
  52. # without actual executing the same query once again. Having the query
  53. # cache enabled may result in significant speed improvements, if your
  54. # have a lot of identical queries and rarely changing tables. See the
  55. # "Qcache_lowmem_prunes" status variable to check if the current value
  56. # is high enough for your load.
  57. # Note: In case your tables change very often or if your queries are
  58. # textually different every time, the query cache may result in a
  59. # slowdown instead of a performance improvement.
  60. query_cache_size=0

  61. # The number of open tables for all threads. Increasing this value
  62. # increases the number of file descriptors that mysqld requires.
  63. # Therefore you have to make sure to set the amount of open files
  64. # allowed to at least 4096 in the variable "open-files-limit" in
  65. # section [mysqld_safe]
  66. table_cache=256

  67. # Maximum size for internal (in-memory) temporary tables. If a table
  68. # grows larger than this value, it is automatically converted to disk
  69. # based table This limitation is for a single table. There can be many
  70. # of them.
  71. tmp_table_size=26M


  72. # How many threads we should keep in a cache for reuse. When a client
  73. # disconnects, the client's threads are put in the cache if there aren't
  74. # more than thread_cache_size threads from before.  This greatly reduces
  75. # the amount of thread creations needed if you have a lot of new
  76. # connections. (Normally this doesn't give a notable performance
  77. # improvement if you have a good thread implementation.)
  78. thread_cache_size=8

  79. #*** MyISAM Specific options

  80. # The maximum size of the temporary file MySQL is allowed to use while
  81. # recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
  82. # If the file-size would be bigger than this, the index will be created
  83. # through the key cache (which is slower).
  84. myisam_max_sort_file_size=100G

  85. # If the temporary file used for fast index creation would be bigger
  86. # than using the key cache by the amount specified here, then prefer the
  87. # key cache method.  This is mainly used to force long character keys in
  88. # large tables to use the slower key cache method to create the index.
  89. myisam_sort_buffer_size=52M

  90. # Size of the Key Buffer, used to cache index blocks for MyISAM tables.
  91. # Do not set it larger than 30% of your available memory, as some memory
  92. # is also required by the OS to cache rows. Even if you're not using
  93. # MyISAM tables, you should still set it to 8-64M as it will also be
  94. # used for internal temporary disk tables.
  95. key_buffer_size=40M

  96. # Size of the buffer used for doing full table scans of MyISAM tables.
  97. # Allocated per thread, if a full scan is needed.
  98. read_buffer_size=64K
  99. read_rnd_buffer_size=256K

  100. # This buffer is allocated when MySQL needs to rebuild the index in
  101. # REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
  102. # into an empty table. It is allocated per thread so be careful with
  103. # large settings.
  104. sort_buffer_size=256K


  105. #*** INNODB Specific options ***
  106. innodb_data_home_dir="E:\Program Files\MySQL\Data\INNODB"

  107. # Use this option if you have a MySQL server with InnoDB support enabled
  108. # but you do not plan to use it. This will save memory and disk space
  109. # and speed up some things.
  110. #skip-innodb

  111. # Additional memory pool that is used by InnoDB to store metadata
  112. # information.  If InnoDB requires more memory for this purpose it will
  113. # start to allocate it from the OS.  As this is fast enough on most
  114. # recent operating systems, you normally do not need to change this
  115. # value. SHOW INNODB STATUS will display the current amount used.
  116. innodb_additional_mem_pool_size=2M

  117. # If set to 1, InnoDB will flush (fsync) the transaction logs to the
  118. # disk at each commit, which offers full ACID behavior. If you are
  119. # willing to compromise this safety, and you are running small
  120. # transactions, you may set this to 0 or 2 to reduce disk I/O to the
  121. # logs. Value 0 means that the log is only written to the log file and
  122. # the log file flushed to disk approximately once per second. Value 2
  123. # means the log is written to the log file at each commit, but the log
  124. # file is only flushed to disk approximately once per second.
  125. innodb_flush_log_at_trx_commit=1

  126. # The size of the buffer InnoDB uses for buffering log data. As soon as
  127. # it is full, InnoDB will have to flush it to disk. As it is flushed
  128. # once per second anyway, it does not make sense to have it very large
  129. # (even with long transactions).
  130. innodb_log_buffer_size=1M

  131. # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
  132. # row data. The bigger you set this the less disk I/O is needed to
  133. # access data in tables. On a dedicated database server you may set this
  134. # parameter up to 80% of the machine physical memory size. Do not set it
  135. # too large, though, because competition of the physical memory may
  136. # cause paging in the operating system.  Note that on 32bit systems you
  137. # might be limited to 2-3.5G of user level memory per process, so do not
  138. # set it too high.
  139. innodb_buffer_pool_size=77M

  140. # Size of each log file in a log group. You should set the combined size
  141. # of log files to about 25%-100% of your buffer pool size to avoid
  142. # unneeded buffer pool flush activity on log file overwrite. However,
  143. # note that a larger logfile size will increase the time needed for the
  144. # recovery process.
  145. innodb_log_file_size=39M

  146. # Number of threads allowed inside the InnoDB kernel. The optimal value
  147. # depends highly on the application, hardware as well as the OS
  148. # scheduler properties. A too high value may lead to thread thrashing.
  149. innodb_thread_concurrency=8
复制代码
*****************配置文件结束*********************

配置文件也放在了附件里,大家可以根据需要修改。

重点是以下配置,其中datadir的目录名称必须是data,并且好像必须是MySQL目录下的data.之前自己制定了其他目录,一直出现1067的错误。

#Path to installation directory. All paths are usually resolved relative to this.
basedir="E:\Program Files\MySQL\"

#Path to the database root
datadir="E:\Program Files\MySQL\Data"

4、在windows环境变量里加入以下内容(方便执行命令行命令)
新建MYSQL_HOME="E:\Program Files\MySQL\",
在Path里加入%MYSQL_HOME%\bin

5、将mysql注册为windows系统服务。具体操作是在命令行中执行以下命令:
mysqld install MySQL --defaults-file="E:\Program Files\MySQL\my.ini"

移除服务为 mysqld remove

6、第5步成功后,在命令行启动mysql
c:>net start mysql

7、修改root的密码为111111
    c:>mysql -uroot
    mysql> UPDATE user SET password=PASSWORD("111111") WHERE user='root';
  mysql> FLUSH PRIVILEGES;
  mysql> QUIT

    my.rar (3.5 KB)
您知道吗,申请VIP会员可以免回复下载,无广告骚扰, 点此处申请

本版积分规则

小黑屋|手机版|Archiver|4K蓝光论坛

GMT+8, 2024-11-15 10:42

Copyright © 2001-2021, Gadaddy Cloud.

快速回复 返回顶部 返回列表