Mysql解压缩版下载安装过程
1、进入https://www.mysql.com/downloads/官网进行mysql的下载
找到downloads首页最下方MySQL Community Edition(GPL)进入下载,下载MySQL Community Server (GPL),我现在的最高版本为(mysql-5.7.21-winx64.zip)。
2、解压缩
可以解压缩到自己的文件夹,我的解压缩目录为:D:\programs\mysql-5.6.38-winx64
3、修改配置文件
进入C:\Program Files\MySQL\MySQL Server 5.6的目录下,将my-default.ini 复制并重命名为my.ini。以下是我的文件,少东西了,导致数据库乱码,刚好贴一下怎么改乱码情况。编辑该文件:
# 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]
# 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 = D:\programs\mysql-5.6.38-winx64
datadir = D:\programs\mysql-5.6.38-winx64\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
注意:basedir=你自己的mysql安装路径
;
datadir=mysql所在目录\data
;
参考:http://blog.csdn.net/JLongSL/article/details/56484762
https://blog.csdn.net/wengengeng/article/details/52013650
这个链接也是超级详细了,看人家的文件设置,可以说很全面了。
4、配置环境变量Path
右键我的电脑 -> 属性 -> 高级系统设置 -> 环境变量 ->从系统变量中找到Path
添加mysql目录下的bin所在路径到Path的末端(不要覆盖Path原值): ;D:\Development\mysql\mysql-5.7.17-winx64\mysql-5.7.17-winx64\bin
也可以动态获取:
5、以管理员权限打开cmd
单击开始,搜索cmd
6、在cmd中进入mysql的bin目录
输入:cd D:\programs\mysql-5.6.38-winx64\bin
接着输入:mysqld -install看到安装成功以后:
关闭服务:
第一次进入mysql时,输入mysql -u root -p,回车,不用输入密码,直接回车。
修改密码:
输入 update mysql.user set password=PASSword('123456') where user='root';回车,执行flush privileges;通过select user();查看已经修改成功(我失败了)。退出,重新登录,此时输入你的密码即可(这里设定的123456)。
使用命令show global variables like 'port';查看端口号 3306
运行修改密码你可能会发现报错:
执行后报错 ERROR 1054(42S22) Unknown column 'password' in ‘field list’
错误的原因是 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
所以请使用一下命令:
update mysql.user set authentication_string=password('*******') where user='*******'; #修改密码成功
https://www.cnblogs.com/wangbaobao/p/7087032.html
更细致的在这里:http://blog.csdn.net/JLongSL/article/details/56484762
乱码
由于 我的配置文件设置不全,出现乱码后:
mysql -u root -p进入mysql命令行输入:show variables like "%char%";查看mysql安装路径
如下:
通过设置字符集后重启服务即可消除乱码:
设置字符集:
以上为MySql的安装过程。
这里有个非常详细的.msi安装过程:http://blog.csdn.net/hisense20112784/article/details/72909701
服务无法启动:
https://blog.csdn.net/liyangyang0528/article/details/54233632
删除服务
mysql以zip安装,解决the service already exists
https://www.cnblogs.com/dichters/p/5929209.html
mysql服务重启和关闭
https://blog.csdn.net/u012385190/article/details/51638059
Mysql net start mysql启动,提示发生系统错误 5 拒绝访问 解决之道
https://blog.csdn.net/htyurencaotang/article/details/8305828