windows 安装 mysql 5.7.12

看着官网文档搞了半天,也不知所已,最后还是搜索了一下,还是中文好懂

1 下载解压部分略。。。

 

2 添加环境变量

 

在path后加上xx盘:/xx目录/mysql-5.7.12-winx64/bin

 

3 mysql-5.7.12-winx64目录下新建my.ini配置文件(也可以直接复制my-default文件然后改名),打开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:/软件/web/mysql/mysql-5.7.12-winx64/"
datadir  ="D:/软件/web/mysql/mysql-5.7.12-winx64/data/"
tmpdir   ="D:/软件/web/mysql/mysql-5.7.12-winx64/data/"
socket   ="D:/软件/web/mysql/mysql-5.7.12-winx64/data/mysql.sock"
log-error="D:/软件/web/mysql/mysql-5.7.12-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:/软件/web/mysql/mysql-5.7.12-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 cmd 以管理员身份进入“命令提示符”

cd 进入mysql-5.7.12-winx64\bin目录下

输入:mysqld --initialize 会自动添加data目录

输入:mysqld install MySQL --defaults-file="D:/xx目录/mysql-5.7.12-winx64/my.ini" 具体路径根据自己的去写(如果提示已经有了 就输入mysqld remove 移除再执行上面的命令)

输入:net start mysql 就可以启动啦

mysql的默认密码为空哦, 你可以自己去设置mysql的密码

补充一下改密码的命令:

进入mydql>后

输入 mysql>use mysql

mysql> update user set authentication_string=password('123456')where user='root';


mysql> flush privileges;
mysql> quit

posted @ 2016-05-10 09:06  web k  阅读(275)  评论(0编辑  收藏  举报