1:在MySql官网下载免安装版
http://downloads.mysql.com/archives/community/
下载链接
http://downloads.mysql.com/archives/get/file/mysql-noinstall-5.1.72-winx64.zip
2:解压到本地目录E:\ProgramFiles\mysql-noinstall-5.1.72-winx64
在该目录下新建log文件夹,E:\ProgramFiles\mysql-noinstall-5.1.72-winx64\log;
在E:\ProgramFiles\mysql-noinstall-5.1.72-winx64该目录下新建my.ini文件,写入以下内容(编码格式Dos\Windows--->ANSI):
5.1.72版本注意注释掉的内容#innodb-strict-mode = 1,否则后面创建服务会报错:
160328 19:57:23 InnoDB: Started; log sequence number 0 44233
160328 19:57:23 [ERROR] E:\ProgramFiles\mysql-noinstall-5.1.72-winx64\bin\mysqld: unknown variable ‘innodb-strict-mode=1‘
[mysql] # CLIENT # port = 3306 socket = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/mysql.sock [mysqld] # GENERAL # user = root default-storage-engine = InnoDB socket = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/mysql.sock pid-file = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/mysql.pid # MyISAM # key-buffer-size = 32M myisam-recover = FORCE,BACKUP # SAFETY # max-allowed-packet = 16M max-connect-errors = 1000000 skip-name-resolve sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY innodb = FORCE #innodb-strict-mode = 1 # DATA STORAGE # basedir = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64 datadir = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/data # BINARY LOGGING # log-bin = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/mysql-bin expire-logs-days = 14 sync-binlog = 1 # CACHES AND LIMITS # tmp-table-size = 32M max-heap-table-size = 32M query-cache-type = 0 query-cache-size = 0 max-connections = 500 thread-cache-size = 50 open-files-limit = 65535 table-definition-cache = 1024 table-open-cache = 2048 # INNODB # innodb-log-files-in-group = 2 innodb-log-file-size = 128M innodb-flush-log-at-trx-commit = 1 innodb-file-per-table = 1 innodb-buffer-pool-size = 3G # LOGGING # log-error = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/log/mysql-error.log log-queries-not-using-indexes = 1 slow-query-log = 1 slow-query-log-file = E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/log/mysql-slow.log
3:以管理员身份打开cmd命令行,依次输入以下内容,每次输入完成后回车:
第一次:cd E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/bin
第二次:e:
第三次:mysqld install MySQL --defaults-file="E:/ProgramFiles/mysql-noinstall-5.1.72-winx64/my.ini"
第四次:net start MySQL
第五次:mysql –uroot
第六次:mysql> show databases;
第七次:mysql>use mysql;
第八次:mysql>update user set password="123456" where user=‘root‘;
第九次:mysql>exit;
第十次:mysql –u root
第十一次:mysql>grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;
第十二次:mysql> use mysql;
第十三次:mysql> select user,host,password from mysql.user;
第十四次:mysql>flush privileges;
第十五次:mysql>quit;
4:使用Navicat Premium连接MySql数据库
下载软件并安装,打开后右键连接--->MySql--->填写属性--->连接测试通过后,确定保存。