WIN7或WIN10 mysql 5.6.35 x64 zip 解压缩版mysql安装方法
背景
本人不是很喜欢mysql的安装版,比较喜欢解压缩版,官网下载比较慢,下面这个地址下载速度还可以。
下载地址:http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/mysql-5.6.35-winx64.zip
安装步骤
下载完解压缩,放到自己习惯使用的目录
D:\SoftwareDev\mysql-5.6.35-winx64
配置环境变量
新增一个MYSQL_HOME的变量,然后在原有的Path变量基础上增加%MYSQL_HOME%\bin
MYSQL_HOME=D:\SoftwareDev\mysql-5.6.35-winx64
Path=....%MYSQL_HOME%\bin
配置修改my-default.ini配置文件的basedir与datadir
# 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:\SoftwareDev\mysql-5.6.35-winx64 datadir = D:\SoftwareDev\mysql-5.6.35-winx64\data # port = ..... # 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
管理员模式安装windows服务
- WIN 10打开管理员命令行的方式
右键开始菜单
- WIN 7打开管理员命令行的方式
左键点击开始菜单
运行如下命令安装名为MySQL的WINDOWS服务
mysqld install MySQL
服务安装成功提示Service successfully installed.
启动MySQL服务
- 命令行启动方式
net start MySQL
- 在服务管理工具中启动
运行services.msc 找到MySQL,右键启动
注意:如果启动发生错误,请详细查看错误日志,在D:\SoftwareDev\mysql-5.6.35-winx64\data\${计算机名}.err
启修改MySQL root用户密码
默认安装完,root密码为空
用mysql命令登录,这里root用户没有密码的,直接回车就好了
我列一下上面每个步骤:
- 切换到mysql这个数据库
use mysql;
- 更新root 用户密码
update user set password=password('123456') where user='root';
- 刷新权限
flush privileges
搞定!
这里再提一点,创建数据库用户,及指定该用户可以访问的数据库的语句
当然首先你得创建一个数据库
create database mydb;
grant all privileges on mydb.* to 'jaychang'@'ip' identified by '123456';
解释下,这里的jaychang为数据库用户名,ip为访问来源ip,这里可以指定ip网段,比如192.168.56.%,表示只有IP地址192.168.56开始的才能访问,也可以是域名。可以是localhost,如果是localhost表示只能再本机*问。identified by 后面的即是jaychang用户的密码。
上一篇: ubuntu安装nginx前安装依赖