MySQL安装

MySql压缩包安装3.7版本

第一步:

  将MySql解压路径,即安装目录(例如:F:MySqlmysql-5.7.20-winx64)配置到系统变量,

新建MYSQL_HOME : F:MySqlmysql-5.7.20-winx64;

将配置好的MYSQL_HOME配置到path中 path : %MYSQL_HOME%in;

第二步:

  在安装目录中配置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.

[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 = 128M

# 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 = F:MySqlmysql-5.7.20-winx64
# datadir = F:MySqlmysql-5.7.20-winx64data
# server_id = .....
# 绑定IPv4和3306端口 
 bind-address = 0.0.0.0
 port =3306 
 max_connections=200

# 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

  文件中的安装路径需要自己修改 basedir、datadir

第三步:

  以管理员的权限打开CMD,

  mysqld --install MySQL  安装MySQL

  net start MySQL  开启MySQL 成功显示“服务已启动成功”;

第四步:

  启动MySQL并修改密码

       在CMD控制台里执行命令  mysql -u root -p 

  回车执行后,输入刚才记录的随机密码

  执行成功后,控制台显示 mysql>,则表示进入mysql

  输入命令set password for root@localhost = password('123'); (注意分号)

  此时root用户的密码修改为123

ps:我在安装过程中遇到一个错误

一开始我以为缺少这个文件,安装之后还是不行出现了其他错误

解决方案:缺少VC2013运行库,下载并安装解决此问题。

原文地址:https://www.cnblogs.com/superxff/p/8012486.html