mysql 5.7.13 安装配置方法图文教程(win10 64位)

本文实例为大家分享了mysql 5.7.13 winx64安装配置方法图文教程,供大家参考,具体内容如下

(1) 下载MySQL程序,您可以从MySQL官网上下载,或者点击这里下载
(2) 解压mysql-5.7.13-winx64.zip文件到你想安装的目录,我的例子是
D:\program\mysql-5.7.13-winx64。其中的目录结构如下:
文件夹:bin docs include lib share
文件: COPYING README my-default.ini
(3) 拷贝文件 my-default.ini 到相同目录下重命名为my.ini。
(4) E盘新建一个mysqlData文件夹。
(5) 在my.ini里面内容清空,重新复制成一下内容。

[client] 
no-beep 
# pipe 
# socket=mysql 
port=3306 
[mysql] 

default-character-set=utf8 

# 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] 
explicit_defaults_for_timestamp = TRUE 

# 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 = 2G 

# Remove leading # to turn on a very important data integrity option: logging 
# changes to the binary log between backups. 
# log_bin 

# These are commonly set, remove the # and set as required. 

basedir="D:\program\mysql-5.7.13-winx64\" 
datadir="E:\mysqlData\" 

port=3306 
server_id=1 

general-log=0 
general_log_file="mysql_general.log" 
slow-query-log=1 
slow_query_log_file="mysql_slow_query.log" 
long_query_time=10 
log-error="mysql_error_log.err" 
default-storage-engine=INNODB 
max_connections=1024 
query_cache_size=128M 
key_buffer_size=128M 
innodb_flush_log_at_trx_commit=1 
innodb_thread_concurrency=128 
innodb_autoextend_increment=128M 
tmp_table_size=128M 

# 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 
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" 
character-set-server=utf8 
innodb_flush_method=normal

(6) 管理员身份进入cmd(以下都是) 同过cd 命令进入到mysql目录下的bin文件夹下。
(7) 执行安装mysql服务的命令:

mysqld --install MySQL --defaults-file=D:\program\mysql-5.7.13-winx64\my.ini

安装成功后提示:Service successfully installed

(8) 为了生成data目录及初始化数据,执行以下命令:

mysqld --initialize

这个命令执行完之后,就会在上文新建的 E:\mysqlData 文件夹里面生成MySQL需要用到的文件和文件夹。

(9) E:\mysqlData 文件夹里面的文件结构如下:
文件夹: mysql、 performance_schema、 sys
文件: auto.cnf DESKTOP-SDK08IO.pid ib_buffer_pool ib_logfile0 ib_logfile1 ibdata1 ibtmp1 mysql_error_log.err mysql_slow_query.log

(10) 在 E:\mysqlData 文件夹里面的mysql_error_log文件里找到下面这一行:

代码如下:

2016-08-02T23:09:18.827488Z 1 [Note] A temporary password is generated for root@localhost: #98um:=-RfbI

临时密码是 root@localhost: 后面的#98um:=-RfbI。

(11) 同一个命令行程序里启动服务net start mysql 。

(12)新开一个命令后程序,进入 D:\program\mysql-5.7.13-winx64\bin 文件夹下,执行命令:

mysql -uroot -p

(13) 输入初始密码连接进入mysql数据库后,修改密码如下:

set password=password('123456');
flush privileges;

(14) 输入exit退出MySQL。
(15) 同一个命令后程序下,用新的密码进入mysql 执行命令:

mysql -uroot -p123456

进入MySQL后输入SQL:

select * from information_schema.TABLES t limit 3;

可以验证一下是否正常安装。

(16) 去MySQL官网下载安装Workbench,这样就可以使用MySQL的图像界面了。

相关推荐