mysql 5.7.21 winx64绿色版安装配置方法图文教程
本文记录了mysql 5.7.21安装配置方法,具体内容如下
1.下载
解压到自己喜欢的一个位置即可(目录中不要包含中文)
如:d:\program files\
2.系统环境变量配置
(1)新增系统变量
变量名:mysql_home
变量值:mysql解压目录,如d:\program files\mysql-5.7.21-winx64
(2)追加path
;%mysql_home%\bin;
3.配置my.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:\\program files\mysql-5.7.21-winx64" datadir = "d:\\program files\mysql-5.7.21-winx64\data" port = 3306 character_set_server = utf8 # 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
4.管理员方式启动命令提示窗符
进入mysql解压目录到bin目录下
如:d:\program files\mysql-5.7.21-winx64\bin
分别执行:
(1)初始化:mysqld -initialize-insecure
如果报错failed to set datadir to 则 执行一下 mysqld --initialize --user=mysql --console,再执行(1);
正确之后会在mysql解压根目录生成data文件夹以及相关文件
(2)mysqld -install
*如提示install/remove of the service denied,说明不是已管理员的方式进入的命令提示符
(3)启动服务:net start mysql
(4)登陆,改密码 mysql -u root -p
【成功登陆的直接到(5)】
我的出现了
在my.ini中增加
重启服务,成功登陆
(5)执行改密码语句 (正常登陆的使用set password= password(‘新密码'); )
update user set authentication_string = password("新密码") where user='root';
(6)exit; net stop mysql
(7)登陆成功的忽略这一步
到my.ini中注释掉
重启进入之后set password= password(‘新密码');
到此就可以正常使用了。
(8)测试 show databases;
5.写两个bat文件用于启动和关闭mysql服务
(1)启动mysql服务
@echo off echo 确定要启动mysql服务吗? pause net start mysql echo 启动mysql服务完成,请确认有没有错误发生。 pause
保存为 mysql服务启动.bat 文件,运行时要以管理员方式运行
(2)关闭mysql服务
@echo off echo 确定要关闭mysql服务吗? pause net stop mysql echo 关闭mysql服务完成,请确认有没有错误发生。 pause
保存为 mysql服务关闭.bat 文件,运行时要以管理员方式运行
mysql到此安装结束。
精彩专题分享:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
推荐阅读
-
mysql8.0.2离线安装配置方法图文教程
-
Windows下mysql5.7.10安装配置方法图文教程
-
Windows server 2008 r2下MySQL5.7.17 winx64安装版配置方法图文教程
-
Ubuntu Server 16.04下mysql8.0安装配置图文教程
-
mysql 5.7.17 winx64.zip安装配置方法图文教程
-
mysql 5.7.11 winx64.zip安装配置方法图文教程
-
mysql 8.0.11 macos10.13安装配置方法图文教程
-
mysql 5.7.17 64bit安装配置方法图文教程
-
Mysql 5.7.17 winx64免安装版,win10环境下安装配置图文教程
-
PHP开发环境配置(MySQL数据库安装图文教程)