windowns下解压缩安装mysql-5.7.11-winx64

1.通过镜像下载mysql
http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.11-winx64.zip
2.解压到D:\software
3.在D:\software\mysql-5.7.11-winx64下新建my.ini配置文件
内容如下:

####################配置文件开始###################

 # For advice on how to change settings please see

 # http://dev.mysql.com/doc/refman/5.7/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  ="D:/software/mysql-5.7.11-winx64/" #注意是正斜杠和资源浏览器复制出来的不一样

 datadir  ="D:/software/mysql-5.7.11-winx64/data/"

 tmpdir   ="D:/software/mysql-5.7.11-winx64/data/"

 socket   ="D:/software/mysql-5.7.11-winx64/data/mysql.sock"

 log-error="D:/software/mysql-5.7.11-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="D:/software/mysql-5.7.11-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

####################配置文件结束###################

4.在windows系统环境变量path,加入如下内容

D:\software\mysql-5.7.11-winx64\bin;(注意加分号)

5 . 初始化配置
mysqld –initialize

6、将mysql注册为windows系统服务
具体操作是在命令行中执行以下命令(需要以管理员身份运行命令行):
需要切换到bin目录,否则,会将服务目录指定为C:\Program Files\MySQL\MySQL Server 5.7\mysqld
增加服务命令:mysqld install MySQL –defaults-file=”D:\software\mysql-5.7.11-winx64\my.ini”
移除服务命令为:mysqld remove

7.第6步成功后,打开系统服务管理

可以看到mysql系统服务
在命令行启动mysql命令为: net start mysql
关闭mysql命令为:net stop mysql

8.修改root的密码为123789

D:\software\mysql-5.7.11-winx64\bin>mysql -u root -p
Enter password: **

临时密码在D:\software\mysql-5.7.11-winx64\data的mysql_error.log文件中,
如:2016-02-19T14:37:57.379157Z 1 [Note] A temporary password is
generated for root@localhost: :ebFk*c;u1ea(临时密码)
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
connection id is 3 Server version: 5.7.11

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights
reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123789';
Query OK, 0 rows affected (0.00 sec)

mysql>

你可能感兴趣的:(mysql)