MySQL版本:mysql-5.6.11-win32.zip (社区版)
操作系统:Win7 32bit, 和 Windows 2008 Server 32bit
MySql 的这个版本的安装与以往稍有不同,记录以备忘;
1.在Oracle网站上下载MySql,需要注册
2.解压到安装目录,比如这里是:D:\MySql\mysql5611
3.配置环境变量:新建一个系统变量: MYSQL_HOME, 值:D:\MySql\mysql5611
4.修改MySql启动配置文件: 将安装目录下文件:my-default.ini 重命名为 my.ini
5.修改my.ini, 比如这个:
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysql] default-character-set=utf8 [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. basedir = d:\Mysql\mysql5611 datadir = d:\Mysql\mysql5611\data default-storage-engine=MYISAM port=3306 server-id=1 bind-address=0.0.0.0 character-set-server=utf8 # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
这里需要额外说明的是:
[mysql] default-character-set=utf8
[mysqld]
character-set-server=utf8
这两个配置是为了保证中文的正常显示,根据需要修改为你期望的字符编码
[mysqld] bind-address=0.0.0.0
这个配置是允许通过网络远程访问mysql服务,如果不去要,请删除此配置项,或者将地址改为:127.0.0.1
6.开始安装MySql
a) 以管理员身份打开cmd,定位到安装目录/bin下
b) 执行安装: mysqld --install MySql服务名
c) 启动MySql服务: net start MySql服务名
7. mysql缺省的root密码为空,修改密码的一种方法是:
a) mysql -u root -p
b) use mysql
c) update mysql.user set password="new password" where User="root";
d) flush privileges;
修改密码正确的SQL: SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');