让window服务进程中自动加载MYSQL

文章作者 100test 发表时间 2007:03:14 13:50:26
来源 100Test.Com百考试题网


在安装mysql解压包时虽然安装成功但在window自动启动时无法加载mysql服务,通过在网上不断的找资料还有自己的实践终于搞定,希望对遇到这要问题的朋友有点作用,

  如何让mysql服务进程中自动加载mysql

  1.在 开始--》运行中执行 c:\mysql\bin\mysqld-nt -install (卸载时执行-uninstall)

  2.把c:/mysql/my-medium.ini改名为my.ini并修改里面的相关配置拷到c:/winnt 或c:/winnts c:/windows 下

  3.然后在开始--》运行 中执行 net start|stop|restart mysql


  下面在本地机上采用安装的方式生成的my.ini

  [注:要根据自己的实际情况修改相应的参数即可]

# mysql server instance configuration file
# ----------------------------------------------------------------------
# generated by the mysql server instance configuration wizard
#
#
# installation instructions
# ----------------------------------------------------------------------
#
# on linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# on windows you should keep this file in the installation directory
# of your server (e.g. c:\program files\mysql\mysql server 4.1). to
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# to run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="c:\program files\mysql\mysql server 4.1\my.ini"
#
# to install the server as a windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install mysql41 --defaults-file="c:\program files\mysql\mysql server 4.1\my.ini"
#
# and then execute this in a command line shell to start the server, e.g.
# net start mysql41
#
#
# guildlines for editing this file
# ----------------------------------------------------------------------
#
# in this file, you can use all long options that the program supports.
# if you want to know the options a program supports, start the program
# with the "--help" option.
#
# more detailed information about the individual options can also be
# found in the manual.
#
#
# client section
# ----------------------------------------------------------------------
#
# the following options will be read by mysql client applications.
# note that only client applications shipped by mysql are guaranteed
# to read this section. if you want your own mysql client program to
# honor these values, you need to specify it as an option during the
# mysql client library initialization.
#
[client]

port=3306

[mysql]

default-character-set=latin1


# server section
# ----------------------------------------------------------------------
#
# the following options will be read by the mysql server. make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

# the tcp/ip port the mysql server will listen on
port=3306


#path to installation directory. all paths are usually resolved relative to this.
basedir="c:/program files/mysql/mysql server 5.0/"

#path to the database root
datadir="c:/program files/mysql/mysql server 5.0/data/"

# the default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=latin1

# the default storage engine that will be used when create new tables when
default-storage-engine=innodb

# set the sql mode to strict
sql-mode="strict_trans_tables,no_auto_create_user,no_engine_substitution"

# the maximum amount of concurrent sessions the mysql server will
# allow. one of these connections will be reserved for a user with
# super privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100

# query cache is used to cache 0select results and later return them
# without actual executing the same query once again. having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. see the
# "qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# note: in case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=0

# the number of open tables for all threads. increasing this value
# increases the number of file descriptors that mysqld requires.
# therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256

# maximum size for internal (in-memory) temporary tables. if a table
# grows larger than this value, it is automatically converted to disk
# based table this limitation is for a single table. there can be many
# of them.
tmp_table_size=5m


# how many threads we should keep in a cache for reuse. when a client
# disconnects, the clients threads are put in the cache if there arent
# more than thread_cache_size threads from before. this greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (normally this doesnt give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=8

#*** myisam specific options

# the maximum size of the temporary file mysql is allowed to use while
# recreating the index (during repair, alter table or load data infile.
# if the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100g

# if the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. this is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size=100g

# if the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. this is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=8m

# size of the key buffer, used to cache index blocks for myisam tables.
# do not set it larger than 30% of your available memory, as some memory
# is also required by the os to cache rows. even if youre not using
# myisam tables, you should still set it to 8-64m as it will also be
# used for internal temporary disk tables.
key_buffer_size=8m

# size of the buffer used for doing full table scans of myisam tables.
# allocated per thread, if a full scan is needed.
read_buffer_size=64k
read_rnd_buffer_size=256k

# this buffer is allocated when mysql needs to rebuild the index in
# repair, optimze, alter table statements as well as in load data infile
# into an empty table. it is allocated per thread so be careful with
# large settings.
sort_buffer_size=212k


#*** innodb specific options ***


# use this option if you have a mysql server with innodb support enabled
# but you do not plan to use it. this will save memory and disk space
# and speed up some things.
#skip-innodb

# additional memory pool that is used by innodb to store metadata
# information. if innodb requires more memory for this purpose it will
# start to allocate it from the os. as this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. show innodb status will display the current amount used.
innodb_additional_mem_pool_size=2m

# if set to 1, innodb will flush (fsync) the transaction logs to the
# disk at each commit, which offers full acid behavior. if you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk i/o to the
# logs. value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1

# the size of the buffer innodb uses for buffering log data. as soon as
# it is full, innodb will have to flush it to disk. as it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=1m

# innodb, unlike myisam, uses a buffer pool to cache both indexes and
# row data. the bigger you set this the less disk i/o is needed to
# access data in tables. on a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. note that on 32bit systems you
# might be limited to 2-3.5g of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=8m

# size of each log file in a log group. you should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. however,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=10m

# number of threads allowed inside the innodb kernel. the optimal value
# depends highly on the application, hardware as well as the os
# scheduler properties. a too high value may lead to thread thrashing.
innodb_thread_concurrency=8



相关文章


Oracle发布新版BerkeleyDB嵌入式数据库
常见数据库系统比较之Oracle数据库
优化Oracle网络设置的方案
Oracle承诺整合Fusion的安全特性
让window服务进程中自动加载MYSQL
如何使用Oracle中的COALESCE函数
Oracle的SOA瞄准SAP的Netweaver
新手必须了解的oracle入门知识
Oracle9i自动PGA管理的新特性
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛