邪恶八进制信息安全团队技术讨论组's Archiver

ring04h 2006-4-24 12:54

[转载]让服务进程中自动加载Mysql服务

<p>信息来源: csdn  </p><p style="TEXT-INDENT: 2em">在安装mysql解压包时虽然安装成功但在WINDOW自动启动时无法加载MYSQL服务,通过在网上不断的找资料还有自己的实践终于搞定,希望对遇到这要问题的朋友有点作用,如何让MYSQL服务进程中自动加载MYSQL。 </p><p style="TEXT-INDENT: 2em">1.在 开始--》运行中执行 c:\mysql\bin\mysqld-nt -install (卸载时执行-uninstall) </p><p style="TEXT-INDENT: 2em">2.把c:/mysql/my-medium.ini改名为my.ini并修改里面的相关配置拷到c:/winnt 或c:/winnts c:/windows 下 </p><p style="TEXT-INDENT: 2em">3.然后在开始--》运行 中执行 net start|stop|restart mysql </p><p style="TEXT-INDENT: 2em">下面在本地机上采用安装的方式生成的my.ini </p><p style="TEXT-INDENT: 2em">[注:要根据自己的实际情况修改相应的参数即可] </p><p style="TEXT-INDENT: 2em"># MySQL Server Instance Configuration File </p><p style="TEXT-INDENT: 2em"># ---------------------------------------------------------------------- </p><p style="TEXT-INDENT: 2em"># Generated by the MySQL Server Instance Configuration Wizard </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># Installation Instructions </p><p style="TEXT-INDENT: 2em"># ---------------------------------------------------------------------- </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># On Linux you can copy this file to /etc/my.cnf to set global options, </p><p style="TEXT-INDENT: 2em"># mysql-data-dir/my.cnf to set server-specific options </p><p style="TEXT-INDENT: 2em"># (@localstatedir@ for this installation) or to </p><p style="TEXT-INDENT: 2em"># ~/.my.cnf to set user-specific options. </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># On Windows you should keep this file in the installation directory </p><p style="TEXT-INDENT: 2em"># of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To </p><p style="TEXT-INDENT: 2em"># make sure the server reads the config file use the startup option </p><p style="TEXT-INDENT: 2em"># "--defaults-file". </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># To run run the server from the command line, execute this in a </p><p style="TEXT-INDENT: 2em"># command line shell, e.g. </p><p style="TEXT-INDENT: 2em"># mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini" </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># To install the server as a Windows service manually, execute this in a </p><p style="TEXT-INDENT: 2em"># command line shell, e.g. </p><p style="TEXT-INDENT: 2em"># mysqld --install MySQL41 --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini" </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># And then execute this in a command line shell to start the server, e.g. </p><p style="TEXT-INDENT: 2em"># net start MySQL41 </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># Guildlines for editing this file </p><p style="TEXT-INDENT: 2em"># ---------------------------------------------------------------------- </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># In this file, you can use all long options that the program supports. </p><p style="TEXT-INDENT: 2em"># If you want to know the options a program supports, start the program </p><p style="TEXT-INDENT: 2em"># with the "--help" option. </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># More detailed information about the individual options can also be </p><p style="TEXT-INDENT: 2em"># found in the manual. </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># CLIENT SECTION </p><p style="TEXT-INDENT: 2em"># ---------------------------------------------------------------------- </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># The following options will be read by MySQL client applications. </p><p style="TEXT-INDENT: 2em"># Note that only client applications shipped by MySQL are guaranteed </p><p style="TEXT-INDENT: 2em"># to read this section. If you want your own MySQL client program to </p><p style="TEXT-INDENT: 2em"># honor these values, you need to specify it as an option during the </p><p style="TEXT-INDENT: 2em"># MySQL client library initialization. </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em">[client] </p><p style="TEXT-INDENT: 2em">port=3306 </p><p style="TEXT-INDENT: 2em">[mysql] </p><p style="TEXT-INDENT: 2em">default-character-set=latin1 </p><p style="TEXT-INDENT: 2em"># SERVER SECTION </p><p style="TEXT-INDENT: 2em"># ---------------------------------------------------------------------- </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em"># The following options will be read by the MySQL Server. Make sure that </p><p style="TEXT-INDENT: 2em"># you have installed the server correctly (see above) so it reads this </p><p style="TEXT-INDENT: 2em"># file. </p><p style="TEXT-INDENT: 2em"># </p><p style="TEXT-INDENT: 2em">[mysqld] </p><p style="TEXT-INDENT: 2em"># The TCP/IP Port the MySQL Server will listen on </p><p style="TEXT-INDENT: 2em">port=3306 </p><p style="TEXT-INDENT: 2em">#Path to installation directory. All paths are usually resolved relative to this. </p><p style="TEXT-INDENT: 2em">basedir="C:/Program Files/MySQL/MySQL Server 5.0/" </p><p style="TEXT-INDENT: 2em">#Path to the database root </p><p style="TEXT-INDENT: 2em">datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/" </p><p style="TEXT-INDENT: 2em"># The default character set that will be used when a new schema or table is </p><p style="TEXT-INDENT: 2em"># created and no character set is defined </p><p style="TEXT-INDENT: 2em">default-character-set=latin1 </p><p style="TEXT-INDENT: 2em"># The default storage engine that will be used when create new tables when </p><p style="TEXT-INDENT: 2em">default-storage-engine=INNODB </p><p style="TEXT-INDENT: 2em"># Set the SQL mode to strict </p><p style="TEXT-INDENT: 2em">sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" </p><p style="TEXT-INDENT: 2em"># The maximum amount of concurrent sessions the MySQL server will </p><p style="TEXT-INDENT: 2em"># allow. One of these connections will be reserved for a user with </p><p style="TEXT-INDENT: 2em"># SUPER privileges to allow the administrator to login even if the </p><p style="TEXT-INDENT: 2em"># connection limit has been reached. </p><p style="TEXT-INDENT: 2em">max_connections=100 </p><p style="TEXT-INDENT: 2em"># Query cache is used to cache SELECT results and later return them </p><p style="TEXT-INDENT: 2em"># without actual executing the same query once again. Having the query </p><p style="TEXT-INDENT: 2em"># cache enabled may result in significant speed improvements, if your </p><p style="TEXT-INDENT: 2em"># have a lot of identical queries and rarely changing tables. See the </p><p style="TEXT-INDENT: 2em"># "Qcache_lowmem_prunes" status variable to check if the current value </p><p style="TEXT-INDENT: 2em"># is high enough for your load. </p><p style="TEXT-INDENT: 2em"># Note: In case your tables change very often or if your queries are </p><p style="TEXT-INDENT: 2em"># textually different every time, the query cache may result in a </p><p style="TEXT-INDENT: 2em"># slowdown instead of a performance improvement. </p><p style="TEXT-INDENT: 2em">query_cache_size=0 </p><p style="TEXT-INDENT: 2em"># The number of open tables for all threads. Increasing this value </p><p style="TEXT-INDENT: 2em"># increases the number of file descriptors that mysqld requires. </p><p style="TEXT-INDENT: 2em"># Therefore you have to make sure to set the amount of open files </p><p style="TEXT-INDENT: 2em"># allowed to at least 4096 in the variable "open-files-limit" in </p><p style="TEXT-INDENT: 2em"># section [mysqld_safe] </p><p style="TEXT-INDENT: 2em">table_cache=256 </p><p style="TEXT-INDENT: 2em"># Maximum size for internal (in-memory) temporary tables. If a table </p><p style="TEXT-INDENT: 2em"># grows larger than this value, it is automatically converted to disk </p><p style="TEXT-INDENT: 2em"># based table This limitation is for a single table. There can be many </p><p style="TEXT-INDENT: 2em"># of them. </p><p style="TEXT-INDENT: 2em">tmp_table_size=5M </p><p style="TEXT-INDENT: 2em"># How many threads we should keep in a cache for reuse. When a client </p><p style="TEXT-INDENT: 2em"># disconnects, the client's threads are put in the cache if there aren't </p><p style="TEXT-INDENT: 2em"># more than thread_cache_size threads from before. This greatly reduces </p><p style="TEXT-INDENT: 2em"># the amount of thread creations needed if you have a lot of new </p><p style="TEXT-INDENT: 2em"># connections. (Normally this doesn't give a notable performance </p><p style="TEXT-INDENT: 2em"># improvement if you have a good thread implementation.) </p><p style="TEXT-INDENT: 2em">thread_cache_size=8 </p><p style="TEXT-INDENT: 2em">#*** MyISAM Specific options </p><p style="TEXT-INDENT: 2em"># The maximum size of the temporary file MySQL is allowed to use while </p><p style="TEXT-INDENT: 2em"># recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. </p><p style="TEXT-INDENT: 2em"># If the file-size would be bigger than this, the index will be created </p><p style="TEXT-INDENT: 2em"># through the key cache (which is slower). </p><p style="TEXT-INDENT: 2em">myisam_max_sort_file_size=100G </p><p style="TEXT-INDENT: 2em"># If the temporary file used for fast index creation would be bigger </p><p style="TEXT-INDENT: 2em"># than using the key cache by the amount specified here, then prefer the </p><p style="TEXT-INDENT: 2em"># key cache method. This is mainly used to force long character keys in </p><p style="TEXT-INDENT: 2em"># large tables to use the slower key cache method to create the index. </p><p style="TEXT-INDENT: 2em">myisam_max_extra_sort_file_size=100G </p><p style="TEXT-INDENT: 2em"># If the temporary file used for fast index creation would be bigger </p><p style="TEXT-INDENT: 2em"># than using the key cache by the amount specified here, then prefer the </p><p style="TEXT-INDENT: 2em"># key cache method. This is mainly used to force long character keys in </p><p style="TEXT-INDENT: 2em"># large tables to use the slower key cache method to create the index. </p><p style="TEXT-INDENT: 2em">myisam_sort_buffer_size=8M </p><p style="TEXT-INDENT: 2em"># Size of the Key Buffer, used to cache index blocks for MyISAM tables. </p><p style="TEXT-INDENT: 2em"># Do not set it larger than 30% of your available memory, as some memory </p><p style="TEXT-INDENT: 2em"># is also required by the OS to cache rows. Even if you're not using </p><p style="TEXT-INDENT: 2em"># MyISAM tables, you should still set it to 8-64M as it will also be </p><p style="TEXT-INDENT: 2em"># used for internal temporary disk tables. </p><p style="TEXT-INDENT: 2em">key_buffer_size=8M </p><p style="TEXT-INDENT: 2em"># Size of the buffer used for doing full table scans of MyISAM tables. </p><p style="TEXT-INDENT: 2em"># Allocated per thread, if a full scan is needed. </p><p style="TEXT-INDENT: 2em">read_buffer_size=64K </p><p style="TEXT-INDENT: 2em">read_rnd_buffer_size=256K </p><p style="TEXT-INDENT: 2em"># This buffer is allocated when MySQL needs to rebuild the index in </p><p style="TEXT-INDENT: 2em"># REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE </p><p style="TEXT-INDENT: 2em"># into an empty table. It is allocated per thread so be careful with </p><p style="TEXT-INDENT: 2em"># large settings. </p><p style="TEXT-INDENT: 2em">sort_buffer_size=212K </p><p style="TEXT-INDENT: 2em">#*** INNODB Specific options *** </p><p style="TEXT-INDENT: 2em"># Use this option if you have a MySQL server with InnoDB support enabled </p><p style="TEXT-INDENT: 2em"># but you do not plan to use it. This will save memory and disk space </p><p style="TEXT-INDENT: 2em"># and speed up some things. </p><p style="TEXT-INDENT: 2em">#skip-innodb </p><p style="TEXT-INDENT: 2em"># Additional memory pool that is used by InnoDB to store metadata </p><p style="TEXT-INDENT: 2em"># information. If InnoDB requires more memory for this purpose it will </p><p style="TEXT-INDENT: 2em"># start to allocate it from the OS. As this is fast enough on most </p><p style="TEXT-INDENT: 2em"># recent operating systems, you normally do not need to change this </p><p style="TEXT-INDENT: 2em"># value. SHOW INNODB STATUS will display the current amount used. </p><p style="TEXT-INDENT: 2em">innodb_additional_mem_pool_size=2M </p><p style="TEXT-INDENT: 2em"># If set to 1, InnoDB will flush (fsync) the transaction logs to the </p><p style="TEXT-INDENT: 2em"># disk at each commit, which offers full ACID behavior. If you are </p><p style="TEXT-INDENT: 2em"># willing to compromise this safety, and you are running small </p><p style="TEXT-INDENT: 2em"># transactions, you may set this to 0 or 2 to reduce disk I/O to the </p><p style="TEXT-INDENT: 2em"># logs. Value 0 means that the log is only written to the log file and </p><p style="TEXT-INDENT: 2em"># the log file flushed to disk approximately once per second. Value 2 </p><p style="TEXT-INDENT: 2em"># means the log is written to the log file at each commit, but the log </p><p style="TEXT-INDENT: 2em"># file is only flushed to disk approximately once per second. </p><p style="TEXT-INDENT: 2em">innodb_flush_log_at_trx_commit=1 </p><p style="TEXT-INDENT: 2em"># The size of the buffer InnoDB uses for buffering log data. As soon as </p><p style="TEXT-INDENT: 2em"># it is full, InnoDB will have to flush it to disk. As it is flushed </p><p style="TEXT-INDENT: 2em"># once per second anyway, it does not make sense to have it very large </p><p style="TEXT-INDENT: 2em"># (even with long transactions). </p><p style="TEXT-INDENT: 2em">innodb_log_buffer_size=1M </p><p style="TEXT-INDENT: 2em"># InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and </p><p style="TEXT-INDENT: 2em"># row data. The bigger you set this the less disk I/O is needed to </p><p style="TEXT-INDENT: 2em"># access data in tables. On a dedicated database server you may set this </p><p style="TEXT-INDENT: 2em"># parameter up to 80% of the machine physical memory size. Do not set it </p><p style="TEXT-INDENT: 2em"># too large, though, because competition of the physical memory may </p><p style="TEXT-INDENT: 2em"># cause paging in the operating system. Note that on 32bit systems you </p><p style="TEXT-INDENT: 2em"># might be limited to 2-3.5G of user level memory per process, so do not </p><p style="TEXT-INDENT: 2em"># set it too high. </p><p style="TEXT-INDENT: 2em">innodb_buffer_pool_size=8M </p><p style="TEXT-INDENT: 2em"># Size of each log file in a log group. You should set the combined size </p><p style="TEXT-INDENT: 2em"># of log files to about 25%-100% of your buffer pool size to avoid </p><p style="TEXT-INDENT: 2em"># unneeded buffer pool flush activity on log file overwrite. However, </p><p style="TEXT-INDENT: 2em"># note that a larger logfile size will increase the time needed for the </p><p style="TEXT-INDENT: 2em"># recovery process. </p><p style="TEXT-INDENT: 2em">innodb_log_file_size=10M </p><p style="TEXT-INDENT: 2em"># Number of threads allowed inside the InnoDB kernel. The optimal value </p><p style="TEXT-INDENT: 2em"># depends highly on the application, hardware as well as the OS </p><p style="TEXT-INDENT: 2em"># scheduler properties. A too high value may lead to thread thrashing. </p><p style="TEXT-INDENT: 2em">innodb_thread_concurrency=8<br /></p>

页: [1]
© 1999-2008 EvilOctal Security Team