先痛述一下我的经历,完整安装步骤请直接看下半段。
64位WIN7下MSI版的MYSQL没有安装成功。在官网上下载了mysql-5.6.14-winx64.zip。
在网上找了两篇安装教程:
http://www.cnblogs.com/banhua/archive/2013/05/01/3053188.html
http://blog.csdn.net/cciii/article/details/13276351
按照第一篇文章里的步骤,到了第4步安装服务的时候,应该输入如下:
mysqld --install mysql --default-file="D:\tools\mysql\mysql-5.6.11-winx64\my.ini" ,
我的在F盘,按了一通backspace想把D改为F,结果光标没定位好,删错了,其他东西也删了。然后我手贱按了一下回车键,心想路径不对应该会提示错误,结果竟然出现服务安装成功。 然后继续做第5步 启动服务,服务怎么也启动不起来,我心想坏了,肯定是刚才的服务安装的有问题。  接着我手动修改了一下注册表:
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/mysql把这个值改为正确的路径。结果还是一样,服务无法启动,系统出错。发生系统错误 1067。 然后我删除了mysql这个键。重启了一下电脑,成功安装服务后还是一样的错误。后来参照了第二篇文章,发现是配置文件的问题。不知道大家注意到没有,第二篇文章里的
loose-default-character-set=utf8 是在[mysqld] 的下面。而第一篇文章里这一处刚好相反,我不知道这个是否影响。我是遵照第二篇文章里的做法。  最关键的是第一篇文章里server没有配置。 配置好server后我再键入
C:\>mysqld --install mysql --default-file="F:\mysql\mysql-5.6.14-winx64\my.ini"
The service already exists! 出现这个错误, 原因是这条命令有问题,这时再遵照第二篇文章的做法。
这次我再F:\mysql\mysql-5.6.14-winx64\bin>mysqld -remove
Service successfully removed.F:\mysql\mysql-5.6.14-winx64\bin>mysqld -install
Service successfully installed.好了,现在按照第一篇文章里的步骤就可以了
F:\>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
********************************************************************
说的有点乱,现在整理一下完整的安装过程
********************************************************************

1、到mysql官网下载mysql-5.6.14-winx64.zip
2、将解压缩后的文件放到自己想要的地方,并配置环境变量。例如我存放的目录为:F:\mysql\mysql-5.6.14-winx64在环境变量中添加:MYSQL_HOME:F:\mysql\mysql-5.6.14-winx64在path路径中加入:%MYSQL_HOME%\bin配置环境变量不是必须的,只是为了能更方便的在命令行中使用mysql的命令行工具。
3、修改ini配置文件5.6.14的解压缩版里有一个my-default.ini文件,copy一份改名为my.ini放在同级目录下。修改my.ini,遵照第二篇文章的做法。我的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.[mysqld]
loose-default-character-set=utf8
basedir = F:/mysql/mysql-5.6.14-winx64
datadir = F:/mysql/mysql-5.6.14-winx64/data

[client]
loose-default-character-set=utf8
[WinMySQLadmin]
Server=F:/mysql/mysql-5.6.14-winx64/bin/mysqld.exe

# 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
# 设置mysql的安装目录# 设置mysql数据库的数据存放目录# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
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 4、安装服务
    进入cmd:
(这个好像要管理员权限,我在C盘下搜索cmd.exe  -->  C:\Windows\winsxs\wow64_microsoft-windows-commandprompt_31bf3856ad364e35_6.1.7601.17514_none_f387767e655cd5ab\cmd.exe,右键以管理员身份运行。这个cmd.exe是64位的cmd。因为我安装的是64位的mysql)    输入命令:
C:\>f:
F:\>cd F:\mysql\mysql-5.6.14-winx64\bin
F:\mysql\mysql-5.6.14-winx64\bin>mysqld -install
Service successfully installed.
5、启动服务
F:\mysql\mysql-5.6.14-winx64\bin>cd\
F:\>net start mysql

MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6、配置用户还在上面的命令窗口里面,输入命令:mysql -u root -p
回车后提示输入密码。
mysql解压缩版初次安装管理员root的密码为空,因此直接再回车一次就登入mysql数据库了。F:\>mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14 MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trade of Oracle Corporation and/or its
affiliates. Other names may be trades of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.成功后输入命令:use mysql;      /*使用mysql数据库*/
mysql> use mysql
Database changed输入命令:select host,user,password from user;    /* 查看系统的账户信息 */
mysql> select host,user,password from user;
+-----------+------+----------+
| host      | user | password |
+-----------+------+----------+
| localhost | root |          |
| 127.0.0.1 | root |          |
| ::1       | root |          |
| localhost |      |          |
+-----------+------+----------+
4 rows in set (0.00 sec)host:代表mysql服务允许哪个IP来的请求。localhost和127.0.0.1指mysql服务所在的主机,即本地。::1是IPV6的IP地址写法,
全称为:0000:0000:0000:0000:0000:0000:0000:0001。现在都是IPV4的网络,可以不用管他。
user:指账户名称。不同的host下账户名称可以相同。
password:密码。
可以看到,默认账户里只支持本地连接,并且账户没有密码。现在的问题明确了,就是要将匿名用户删除,为root用户添加远程访问和密码,再为自己添加个人账户。指令如下:mysql> update user set password=PASSWORD('root') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0mysql> grant all on *.* to root@'%' identify by 'root';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by 'root'' at line 1
mysql> grant all on *.* to walle@'%' identify by '123456' with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by '123456' with grant option' at line 1
mysql> delete from where user='';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'where
 user=''' at line 1
mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host      | user | password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 127.0.0.1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| ::1       | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost |      |                                           |
+-----------+------+-------------------------------------------+
4 rows in set (0.00 sec)mysql> commit;
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)大家可以看到最后一步中有两天语句有错误,不过这不打紧,至此数据库已经安装成功了。
大家可以用这篇文章里介绍的语句来测试一下:
http://hi.baidu.com/tonny_dxf/item/12167986d46f01ccee083d2b
亲测好用。祝您安装愉快。