MYSQL5.7绿色版安装

日常吐槽

因为PowerDesigner 需要32位的MySql,那只好再装一个呗,本以为是分分钟的事,好家伙!!!由于本来电脑里就有环境,结果进了好几个坑…

安装

绿色版地址 https://pan.baidu.com/s/1rU-S644jv1z32BiN-FM_YA 提取码:epu9

安装步骤:

  1. 配置环境变量
    把bin 的地址配置到环境变量的path中,F:\software\mysql-5.7.18-win32\bin
    (第一个坑:我用了同事写的配环境变量的工具,这个工具默认从尾部添加,因为本来电脑里装了8.0的mysql,path里自动配置过了8.0的环境变量,导致后面启动服务出错…所以强烈建议 新的环境变量从头开始添加!!!)

  2. 在F:\software\mysql-5.7.18-win32 下创建my-default.ini文件 并修改basedir 和datadir的内容
    (第二个坑:原本我建的是my.ini 文件,但是后面一直启动服务失败,改成my-default.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]

# 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:\software\mysql-5.7.18-win32
datadir = F:\software\mysql-5.7.18-win32\data
port = 3306
# server_id = .....


# 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 
  1. 用管理员权限运行cmd,并进入bin文件夹
    在这里插入图片描述

  2. 执行mysqld -install安装成服务,如果之前有安装过,则卸载(mysqld -remove)后再执行安装;

  3. 运行mysqld --initialize --console 生成data文件夹,并记住生成的密码
    在这里插入图片描述

  4. 启动服务:net start mysql;或者通过右键计算机-管理-服务,找到MYSQL开启,设置成自动;
    (如果提示net 不是内部命令,配置path环境变量 %SystemRoot%\system32,配置完环境变量需要重新打开cmd,不然原本的cmd用的是老的环境变量。如果本来系统里配置过了还是提示,删了,放在开头)

  5. 登入并修改密码

F:\software\mysql-5.7.18-win32\bin>mysql -uroot -p //登录mysql
Enter password: ************ //密码就是输入的密码
mysql> set password=password('root'); //修改密码
Query OK, 0 rows affected, 1 warning (0.00 sec)
  1. 授权远程连接权限:grant all privileges on . to root@’%’ identified by ‘root’;

猜你喜欢

转载自blog.csdn.net/u010717084/article/details/85265791