首页 > 代码库 > win7下安装64位 mysql 5.7.4

win7下安装64位 mysql 5.7.4

 

1:下载64位mysql压缩包:http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17-winx64.zip

2:解压,路径自己定,我的是在S:\program\mysql-5.7.4-m14-winx64 。

3:新建my.ini , 内容如下,我从网上copy的一个:

####################配置文件开始################### # 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. [client] default-character-set=utf8  [mysqld] port=3306 basedir="S:/program/mysql-5.7.4-m14-winx64" datadir="S:/program/mysql-5.7.4-m14-winx64/data/" tmpdir="S:/program/mysql-5.7.4-m14-winx64/data/" socket="S:/program/mysql-5.7.4-m14-winx64/data/mysql.sock" log-error="S:/program/mysql-5.7.4-m14-winx64/data/mysql_error.log"  #server_id = 2 #skip-locking  max_connections=100 table_open_cache=256 query_cache_size=1M  tmp_table_size=32M thread_cache_size=8  innodb_data_home_dir="S:/program/mysql-5.7.4-m14-winx64/data/" innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128M innodb_buffer_pool_size=128M innodb_log_file_size=10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M read_rnd_buffer_size = 32M max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES####################配置文件结束###################

注意上面有路径的地方要换成自己的路径。

其中datadir路径必须是xxx/data/。(如果不使用这个路径,会出现什么情况?这里没试验...)

4:在系统环境变量中path中加入:

;S:\program\mysql-5.7.4-m14-winx64\bin;  (替换成自己的路径,注意要加分号)

5:运行cmd,要以管理员权限运行,然后切换到bin下:

执行增加服务命令 :  mysqld intall MySQL     (MySQL 是服务的名字,这个可以随便取吧)

移除服务的命令是: mysqld remove MySQL

6:然后控制面板-管理工具-服务,找到MySQL,右键启动。

7:修改root密码:

命令行执行:mysql –uroot

 

mysql>show databases;

mysql>use mysql;

mysql> UPDATE user SET password=PASSWORD(‘123456‘) WHERE user=‘root‘;

mysql> FLUSH PRIVILEGES;

mysql> QUIT

 

至此mysql就安装完毕了,然后可以用可视化工具登录了。如果是远程登录的话,还需要加权限。这里暂时没有弄,就先不细说了。

 

注:启动服务的时候我遇到了1067错误,经过检查后发现是my.ini里路径配置有误。