欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

绿色版 mysql 安装配置

程序员文章站 2023-11-24 08:44:40
一、下载mysql http://www.mysql.org/downloads 我下载的是mysql-noinstall-5.0.67-win32.zip 二、安装...
一、下载mysql
http://www.mysql.org/downloads
我下载的是mysql-noinstall-5.0.67-win32.zip
二、安装过程
 1、解压缩
mysql-noinstall-5.0.67-win32.zip 到一个c盘,重新命名为 mysql5
      假定mysql_home=c:\
mysql5
 2、编辑mysql的运行配置文件my.ini,如果没有,可以拿my-medium.ini复制然后更名成 my.ini 
复制代码 代码如下:

# example mysql config file for medium systems.  
#  
# this is for a system with little memory (32m - 64m) where mysql plays  
# an important part, or systems up to 128m where mysql is used together with  
# other programs (such as a web server)  
#  
# you can copy this file to  
# /etc/my.cnf to set global options,  
# mysql-data-dir/my.cnf to set server-specific options (in this  
# installation this directory is c:\mysql\data) or  
# ~/.my.cnf to set user-specific options.  
#  
# in this file, you can use all long options that a program supports.  
# if you want to know which options a program supports, run the program  
# with the "--help" option.  

# the following options will be passed to all mysql clients  
[client]  
#password   = your_password 
port        = 3306 
socket      = /tmp/mysql.sock  

# here follows entries for some specific programs  

# the mysql server  
[mysqld]  
basedir = "c:\mysql5" 
datadir = "c:\mysql5\data" 
default-character-set=utf8 

port        = 3306 
socket      = /tmp/mysql.sock  
skip-locking  
key_buffer = 16m 
max_allowed_packet = 1m 
table_cache = 64 
sort_buffer_size = 512k 
net_buffer_length = 8k 
read_buffer_size = 256k 
read_rnd_buffer_size = 512k 
myisam_sort_buffer_size = 8m 

# don't listen on a tcp/ip port at all. this can be a security enhancement,  
# if all processes that need to connect to mysqld run on the same host.  
# all interaction with mysqld must be made via unix sockets or named pipes.  
# note that using this option without enabling named pipes on windows  
# (via the "enable-named-pipe" option) will render mysqld useless!  
#   
#skip-networking  

# disable federated by default  
skip-federated  

# replication master server (default)  
# binary logging is required for replication  
log-bin=mysql-bin  

# 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 

# replication slave (comment out master section to use this)  
#  
# to configure this host as a replication slave, you can choose between  
# two methods :  
#  
# 1) use the change master to command (fully described in our manual) -  
#    the syntax is:  
#  
#    change master to master_host=<host>, master_port=<port>,  
#    master_user=<user>, master_password=<password> ;  
#  
#    where you replace <host>, <user>, <password> by quoted strings and  
#    <port> by the master's port number (3306 by default).  
#  
#    example:  
#  
#    change master to master_host='125.564.12.1', master_port=3306,  
#    master_user='joe', master_password='secret';  
#  
# or  
#  
# 2) set the variables below. however, in case you choose this method, then  
#    start replication for the first time (even unsuccessfully, for example  
#    if you mistyped the password in master-password and the slave fails to  
#    connect), the slave will create a master.info file, and any later  
#    change in this file to the variables' values below will be ignored and  
#    overridden by the content of the master.info file, unless you shutdown  
#    the slave server, delete master.info and restart the slaver server.  
#    for that reason, you may want to leave the lines below untouched  
#    (commented) and instead use change master to (see above)  
#  
# required unique id between 2 and 2^32 - 1  
# (and different from the master)  
# defaults to 2 if master-host is set  
# but will not function as a slave if omitted  
#server-id       = 2 
#  
# the replication master for this slave - required  
#master-host     =   <hostname> 
#  
# the username the slave will use for authentication when connecting  
# to the master - required  
#master-user     =   <username> 
#  
# the password the slave will authenticate with when connecting to  
# the master - required  
#master-password =   <password> 
#  
# the port the master is listening on.  
# optional - defaults to 3306  
#master-port     =  <port> 
#  
# binary logging - not required for slaves, but recommended  
#log-bin=mysql-bin  

# point the following paths to different dedicated disks  
#tmpdir     = /tmp/       
#log-update     = /path-to-dedicated-directory/hostname  

# uncomment the following if you are using bdb tables  
#bdb_cache_size = 4m 
#bdb_max_lock = 10000 

# uncomment the following if you are using innodb tables  
#innodb_data_home_dir = c:\mysql\data/  
#innodb_data_file_path = ibdata1:10m:autoextend  
#innodb_log_group_home_dir = c:\mysql\data/  
#innodb_log_arch_dir = c:\mysql\data/  
# you can set .._buffer_pool_size up to 50 - 80 %  
# of ram but beware of setting memory usage too high  
#innodb_buffer_pool_size = 16m 
#innodb_additional_mem_pool_size = 2m 
# set .._log_file_size to 25 % of buffer pool size  
#innodb_log_file_size = 5m 
#innodb_log_buffer_size = 8m 
#innodb_flush_log_at_trx_commit = 1 
#innodb_lock_wait_timeout = 50 

[mysqldump]  
quick  
max_allowed_packet = 16m 

[mysql]  
no-auto-rehash  
# remove the next comment character if you are not familiar with sql  
#safe-updates  

[isamchk]  
key_buffer = 20m 
sort_buffer_size = 20m 
read_buffer = 2m 
write_buffer = 2m 

[myisamchk]  
key_buffer = 20m 
sort_buffer_size = 20m 
read_buffer = 2m 
write_buffer = 2m 

[mysqlhotcopy]  
interactive-timeout


[mysqld]
# 设置mysql的安装目录
basedir=$mysql_home
# 设置mysql数据库的数据的存放目录,必须是data,或者是
datadir=$mysql_home\data
# 设置mysql服务器的字符集
default-character-set=utf8

[client]
# 设置mysql客户端的字符集
default-character-set=gbk

3、安装mysql服务
从ms-dos窗口进入目录e:\myserver\mysql-5.0.37-win32\bin,运行如下命令:
mysqld --install mysql --defaults-file=c:\mysql5\my.ini

4、启动mysql数据库
还在上面的命令窗口里面,输入命令:net start mysql
这样就启动了mysql 服务。

5、停止服务
执行 net stop mysql 即可
6、删除服务
执行mysqld --remove mysql 即可

7、修改密码
以上安装完毕之后,默认的root用户密码为空的。为了安全起见,需要设置一个root用户的密码。
复制代码 代码如下:

<strong><span style="color: #ffffff" style="color: #ffffff">c:\>cd mysql5  

c:\mysql5>cd bin  

c:\mysql5\bin>mysql -uroot -p  
enter password:  
welcome to the mysql monitor.  commands end with ; or \g.  
your mysql connection id is 3  
server version: 5.0.67-community-log mysql community edition (gpl)  

type 'help;' or '\h' for help. type '\c' to clear the buffer.  

mysql> use mysql  
database changed  
mysql> update user set password=password('admin') where user='root';  
query ok, 2 rows affected (0.08 sec)  
rows matched: 2  changed: 2  warnings: 0</span> 

</strong>
(0)
打赏 绿色版 mysql 安装配置 微信扫一扫

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

绿色版 mysql 安装配置
验证码: 绿色版 mysql 安装配置