日期:2014-05-16  浏览次数:20788 次

MySQL免安装版配置与安装

step1:解压mysql包,我的路径是E:\mysql-5.5.19,就用%MySQL_HOME%表示。

step2:写my.ini文件,这个是mysql启动时的配置文件,压缩包里默认提供了几个配置模版,my-small.ini,?my-medium.ini,?my-large.ini,?my-huge.ini, my-innodb-heavy-4G.ini。这几个模版的主要区别是和内存有关的。

如small模版就说:如果系统内存小于64M,并且mysql不常用使用,那就用这个模版,并且使用这个模版mysqld??daemon守护精灵占用的资源最少。这个基本上就是做嵌入式数据库啦。

如果数据库在你的开发中应用中扮演一个比较重要的角色,那就用medium模版。medium模版即适合32M-64M内存的系统使用,又可以满足web开发使用。(是它自己说的,看来这个是全能型选手)

large模版,如果你的系统内存有512M,并且主要运行mysql,那就用这个。(512M现在大家都能轻松达到吧~~)

huge模版,就是系统内存在1G-2G之间用的。

my-innodb-heavy-4G这个模版就厉害,系统4G内存,并且只使用innodb表。这个基本上就是单做数据库服务器才用的。

以下贴上我的my.ini配置:

?

# The following options will be passed to all MySQL clients
[client]
# set default character for client
default-character-set=utf8
#password	= your_password
port		= 3306
socket		= /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8
#Path to installation directory. All paths are usually resolved relative to this.
basedir="E:/mysql-5.5.19/"
#Path to the database root
datadir="E:/mysql-5.5.19/data/"
# 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=50
# Query cache is used to cache SELECT 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=67108864
# 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=9M
# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# 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 doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=16

port		= 3306
socket		= /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin

# binary logging format - mixed recommended
binlog_format=mixed

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id	= 1

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir ="E:/mysql-5.5.19/data/"
innodb_data_file_path = ibdata1:10M