在 windows 上安装免安装版的mysql

在 windows 上安装免安装版的

1、 下载路径 https://downloads.mysql.com/archives/community/

2、 解压

假设解压后的路径为:E:\Environment\mysql-5.6.30-winx64

在path环境变量下加入:E:\Environment\mysql-5.6.30-winx64\bin

3、复制 my-default.ini ,生成 my.ini

在 [mysqld] 下面 加入 指定配置

port=3306

character_set_server=utf8

basedir=E:\Environment\mysql-5.6.30-winx64

datadir=E:\Environment\mysql-5.6.30-winx64\data

完整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 = .....
# datadir = .....
# 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 [client]
port=3306
default-character-set=utf8 [mysqld]
port=3306 character_set_server=utf8
#character_set_server=utf8 一定要这样写; basedir=E:\Environment\mysql-5.6.30-winx64
#解压目录 datadir=E:\Environment\mysql-5.6.30-winx64\data
#解压目录下data目录,必须为data目录 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

4、注册windows系统服务

将mysql注册为windows系统服务

操作如下:

1)从控制台进入到MySQL解压目录下的 bin 目录下:

2)输入服务安装命令:

mysqld install MySQL --defaults-file="D:\Program Files\MySQL\mysql-5.6.16-win32\my.ini"

解压目录下修改的my.ini文件

安装成功后会提示服务安装成功。

注:my.ini文件放在MySQL解压后的根目录下

移除服务命令为:mysqld remove

5、启动MySQL服务

方法一:

启动服务命令为:net start mysql

若报错:MySQL 服务无法启动 1067错误;查看data目录下的err文件看错误:

2014-02-27 10:50:12 5360 [ERROR] InnoDB: .\ibdata1 can't be opened in read-write mode

2014-02-27 10:50:12 5360 [ERROR] InnoDB: The system tablespace must be writable!

2014-02-27 10:50:12 5360 [ERROR] Plugin 'InnoDB' init function returned error.

2014-02-27 10:50:12 5360 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

2014-02-27 10:50:12 5360 [ERROR] Unknown/unsupported storage engine: InnoDB

2014-02-27 10:50:12 5360 [ERROR] Aborting

解决方法:删除data目录下的ib_logfile0和ib_logfile1文件。

再次启动,正常

方法二:

打开管理工具 服务,找到MySQL服务。

通过右键选择启动或者直接点击左边的启动来启动服务。

6、 修改 root 账号的密码

方法一:

刚安装完成时root账号默认密码为空,此时可以将密码修改为指定的密码。如:123456

c:>mysql –u root

mysql>show databases;

mysql>use mysql;

mysql>update user set password=PASSWORD("新密码") where user='root';

mysql>FLUSH PRIVILEGES;

mysql>QUIT

7、设置mysql远程访问:

grant all privileges on . to 'root'@'%' identified by 'root用户的密码' with grant option

8、 安装完成。可以 下载 “Navicat premium ” 来试试 远程连接。

上一篇:Protel99se教程二:使用protel99se原理图绘制


下一篇:团体程序设计天梯赛 L1-006. 连续因子