本文针对mysql-noinstall版本,也就是解压缩版的安装配置应用做了个总结,这些操作都是平时很常用的操作。文章中不对mysql的可执行文 件安装版做介绍了,可执行安装版有很多的弊端,我也不一一说了。总之,我喜欢绿色环保的,包括eclipse、tomcat、jboss、apache也 是,即使操作系统重装了,这些软件也不需要重装,可谓一劳永逸!

环境:
Windows 7

mysql-5.5.22-win32.zip

一、下载MySQL

我的下载地址:http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.5/mysql-5.5.22-win32.zip
(你可以去官网下最新版本的)

二、安装过程

1、解压缩mysql-5.5.22-win32.zip到一个目录,例如我自己的是D:\mysql-5.5.22-win32。

2、在mysql-5.1.62 目录下新建一个my.ini,拷贝my-large.ini代码至my.ini;修改后如下(中文说明为添加部分):

# Example MySQL config file for large systems.
#
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = ling
port  = 3306
socket  = /tmp/mysql.sock
#设置客户端字符集
default-character-set=utf8
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port  = 3306
socket  = MySQL
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
#这里是我们修改的内容
basedir=D:\\mysql-5.5.22-win32
# 设置mysql数据库的数据的存放目录,必须是data,或者是\\xxx\data
datadir=D:\\mysql-5.5.22-win32\\data
# 设置mysql服务器的字符集
default-character-set=utf8
#Server=L:/mysql-noinstall-5.1.62-win32/bin/mysqld-nt.exe
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = C:\\mysql\\data\\
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:\\mysql\\data\\
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 256M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 64M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
3、给系统path环境变量添加:D:\mysql-5.5.22-win32\bin
然后编写启动脚本startup.bat,放在D:\mysql-5.5.22-win32\bin路径下,此启动脚本会将mysql5注册到系统服务中:
@echo off
echo start mysql5 on localhost
mysqld --install mysql5 --defaults-file=D:\mysql-5.5.22-win32\my.ini
net start mysql5
pause
停止脚本stop.bat放在D:\mysql-5.5.22-win32\bin路径下,停止脚本会将系统服务中MySQL5卸载掉:
@echo off
echo stop mysql5
net stop mysql5
mysqld --remove mysql5
pause
6、配置完毕后,右键以管理员身份运行D:\mysql-5.5.22-win32\bin路径下的startup.bat批处理文件,在系统服务中有一个mysql5的服务,并且已经启动,然后测试下数据库的安装情况,
在dos窗口下,进入D:\>cd D:\mysql-5.5.22-win32\bin路径下,输入mysqlshow,即可显示数据库信息,
示例如下:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\guoy>d:

D:\>cd D:\mysql-5.5.22-win32\bin

D:\mysql-5.5.22-win32\bin>mysqlshow
+--------------------+
| Databases |
+--------------------+
| information_schema |
| test |
+--------------------+

D:\mysql-5.5.22-win32\bin>

如上信息说明数据库安装成功还有其他测试命令:
mysqlshow -u root mysql
mysqladmin -u root version status proc

//===========================================================================//

免安装版本,访问MySQL时常会出现:access denied for user 'root'@'localhost' using password yes
出现这种情况多是root密码没有设置或错误,解决办法如下:
 
1. 管理员登陆系统,停止 MySQL 服务或者结束 MySQL 进程。
2. 启动 WINDOWS 的命令行窗口(即通常的 DOS 窗口),切换到你的 “MySQL\bin” 目录下。
例如我的是 “D:\SERVER\MySQL5122\bin”,然后执行下面的粗体的命令:
(注意你的 “my.ini” 位置)
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\MMC>d:
D:\>cd D:\SERVER\MySQL5122\bin
D:\SERVER\MySQL5122\bin>mysqld --defaults-file="D:\SERVER\MySQL5122\my.ini" --console --skip-grant-tables
090801 4:43:54 InnoDB: Started; log sequence number 0 585546
090801 4:43:54 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
090801 4:43:54 [Note] mysqld: ready for connections.
Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server (GPL)
_
 可能会出现一些警告信息和错误,但只要出现下面信息,就说明 MySQL 已经起来了。
Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server (GPL)
3. 不关闭此命令行窗口,重新打开一个命令行窗口,同样切到 “mysql\bin” 目录下,然后执行下面的粗体的命令:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\MMC>d:
D:\>cd D:\SERVER\MySQL5122\bin
D:\SERVER\MySQL5122\bin>mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.22-rc-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
到这步,我想任何一个使用 MySQL 的人都知道后面要做什么了!(^a^)
mysql>
mysql> UPDATE user SET Password=PASSWORD('mynewpass') where USER='root';
Query OK, 2 rows affected (0.05 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye
4. 好了到此步,可以关闭第一个 DOS 窗口了。打开系统服务控制窗口(控制面板--管理工具--服务),启动 MySQL 服务。
5. 在剩下的第二个 DOS 窗口中,用新的 ROOT 密码连接 MySQL。
D:\SERVER\MySQL5122\bin>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.22-rc-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> quit
Bye
至此,系统恢复 ROOT 用户管理权限完成。

//====================================================================//

对于安装版MYSQL完全卸载方法

第一次安装mysql输入密码后,如果你想卸载重装,便会出现要求输入原来设定的密码,否则安装不成功。遇到这样的问题,是你没有完全卸载mysql数据库。

MysqlQ完全卸载方法:

1.清除MYSQL的安装目录,默认是C:Program Files

2.清除MYSQL数据存放目录,一般在C:programData目录下(win7)或者C:Documents and SettingsAll Users.windowsApplication Data(XP)目录下删除MySQL文件夹。

(需要注意的时Application Data这个文件夹默认是隐藏的,要通过 工具->文件夹选项->查看->显示所有文件与文件夹来设置隐藏文件可见)。

3.这步很重要,之前不管我怎么卸载MYSQL清空残余文件都还是要输入原始密码,后来试试找了***册表,清空后果然有效。

删除注册表数据,通过regedit,删除以下几个文件:

HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Applications/MySQL

HKEY_LOCAL_MACHINE/SYSTEM/ControlSet002/Services/Eventlog/Applications/MySQL

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Applications/MySQL

至此Mysql数据库便完全卸载了,然后重新安装即可。

Windows下mysql忘记root密码的解决方法

Mysql版本:5.1.55-community MySQL Community Server (GPL)

1、 首先检查mysql服务是否启动,若已启动则先将其停止服务,可在开始菜单的运行,使用命令:

net stop mysql

或者在windows任务管理器中结束mysqld.exe进程,或者在控制面板,管理工具里面的服务找到mysql,将其停止服务。

打开第一个cmd窗口,切换到mysql的bin目录,运行命令:

mysqld --defaults-file="C:Program FilesMySQLMySQL Server 5.1my.ini" --console --skip-grant-tables

注释:

该命令通过跳过权限安全检查,开启mysql服务,这样连接mysql时,可以不用输入用户密码。

"C:Program FilesMySQLMySQL Server 5.1my.ini"指配置文件my.ini,一般在mysql安装目录里面。

如:

===============================================================================

C:Program FilesMySQLMySQL Server 5.1bin>mysqld --defaults-file="C:Program FilesMySQLMySQL Server 5.1my.ini" --console --skip-grant-tables

110301 9:20:07 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.

110301 9:20:07 [Note] Plugin 'FEDERATED' is disabled.

110301 9:20:07 InnoDB: Initializing buffer pool, size = 46.0M

110301 9:20:07 InnoDB: Completed initialization of buffer pool

110301 9:20:07 InnoDB: Started; log sequence number 0 44233

110301 9:20:07 [Note] mysqld: ready for connections.

Version: '5.1.55-community' socket: '' port: 3306 MySQL Community Server (GPL)

2、打开第二个cmd窗口,连接mysql:

输入命令:

mysql -uroot -p

出现:

Enter password:

在这里直接回车,不用输入密码。

然后就就会出现登录成功的信息,

如:

===============================================================================

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 3

Server version: 5.1.55-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

===============================================================================

使用命令:

show databases;

显示已有数据库:

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

+--------------------+

3 rows in set (0.00 sec)

使用命令切换到mysql数据库:

use mysql;

使用命令更改root密码:

UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

刷新权限:

FLUSH PRIVILEGES;

然后退出,重新登录:

quit

重新登录:

mysql -uroot -p

出现输入密码提示,输入新的密码即可登录:

Enter password: ***********

显示登录信息:

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 9

Server version: 5.1.55-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

到这里root密码就已经修改成功了,用Ctrl+C将第一个cmd窗口结束,那样就会停止mysql服务,如:

=============================================================================== C:Program FilesMySQLMySQL Server 5.1bin>mysqld --defaults-file="C:Program F

ilesMySQLMySQL Server 5.1my.ini" --console --skip-grant-tables

110301 10:29:47 [Warning] '--default-character-set' is deprecated and will be re

moved in a future release. Please use '--character-set-server' instead.

110301 10:29:47 [Note] Plugin 'FEDERATED' is disabled.

110301 10:29:47 InnoDB: Initializing buffer pool, size = 46.0M

110301 10:29:47 InnoDB: Completed initialization of buffer pool

110301 10:29:48 InnoDB: Started; log sequence number 0 44233

110301 10:29:48 [Note] mysqld: ready for connections.

Version: '5.1.55-community' socket: '' port: 3306 MySQL Community Server (GPL)

(此处输入ctrl+c)

110301 10:30:58 [Note] mysqld: Normal shutdown

110301 10:30:58 InnoDB: Starting shutdown...

110301 10:31:03 InnoDB: Shutdown completed; log sequence number 0 44233

110301 10:31:03 [Note] mysqld: Shutdown complete

Mysql服务停止了,输入命令:

net start mysql,即可重新启动mysql服务,如:

===============================================================================

C:Program FilesMySQLMySQL Server 5.1bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

C:Program FilesMySQLMySQL Server 5.1bin>

可以参考:http://www.cnblogs.com/firstdream/archive/2012/04/06/2434894.html

图解安装步骤:http://hi.baidu.com/houwenbin1986/blog/item/affbb70eef75abe7ab64578a.html

转载于:https://blog.51cto.com/ww123/1683929

WIndows 下安装mysql (non-install版本,即绿色版,或称为 源码包)相关推荐

  1. mysql-win安装教程,WINDOWS下安装MYSQL教程详解

    1.下载安装包 2.配置环境变量 2.1 解压所下载的压缩包 2.2 环境变量 win 10 电脑 这么进去 3.生成data文件 在你解压的目录下,eg:F:\Program Files\mysql ...

  2. Windows 下安装mysql

    Windows 下安装mysql 1.配置环境变量 将安装目录添加到系统路径 我的电脑->属性->高级->环境变量->path 2.修改my.ini 位于解压安装目录下 在其中 ...

  3. RPM方式安装MySQL5.6和windows下安装mysql解压版

    下载地址: http://cdn.MySQL.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpm http://cdn.mysql. ...

  4. Windows下安装mysql的操作步骤

    Windows下安装mysql的操作步骤 免安装版的Mysql MySQL关是一种关系数据库管理系统,所使用的 SQL 语言是用于访问数据库的最常用的 标准化语言,其特点为体积小.速度快.总体拥有成本 ...

  5. 与mysql数据库的交互实战_实战教程丨五步教你优雅地在Windows下安装MySQL数据库...

    虽说近几个月全球的经济都不怎么景气,但有个事实我们必须得承认: 各行各业的数据体量正在不断变大. 而随着数据体量的不断扩大,各公司使用数据库管理来数据再常见不过.比如MySQL这样的关系型数据库,互联 ...

  6. Windows下安装MySQL数据库

    windows下安装MySQL数据库,照着帖子安装了两个电脑,没次都有一点小错误,参考别人的安装记录,根据自己的安装过程,记录一下.(一个电脑安装的5.7.25 一个电脑安装的5.7.26) 一.My ...

  7. mysql数据库安装以及登录(如何在windows下安装mysql数据库,以及解决mysql8登录报错问题,绝对是保姆级别的,不要错过哦)

    目录 概述 MySQL的卸载(选看) 停止MySQL服务 软件的卸载 方式1:通过控制面板方式 方式2:通过360或电脑管家等软件卸载 方式3:通过安装包提供的卸载功能卸载 残余文件的清理 清理注册表 ...

  8. windows 下 安装mysql 出现 “ ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password

    这个问题是在Windows下安装MySQL服务时遇到的,使用MySQl绿色版进行安装的,安装完成后,连接到MySQL服务时输入命令 " mysql -uroot -p " ,因为时 ...

  9. Windows下安装Boot Camp提示版本不适用

    Windows下安装Boot Camp提示版本不适用 在苹果官网下载boot camp,Windows下解压点击setup安装,提示版本不适用. 那就到解压后的文件BootCamp\Drivers\A ...

  10. 安装mysql 图_如何在Windows下安装MYSQL,并截图说明

    说明 : window 下安装 mysql 虽然简单,但是细节不注意就会安装失败,特别是配置服务器时,Current Root Password:为空:如果输入密码了在后面安装会报错.(不知道设置这个 ...

最新文章

  1. cufflinks基于dataframe数据绘制三维散点图(3d scatter plot)
  2. 分析460万份数据发现,女警比男警检查汽车几率少2倍,但发现违禁品还多10%
  3. mysql命令导入导出数据_mysql命令行导入和导出数据
  4. SQLServer删除登录帐户
  5. 从有界到无界,腾讯新一代企业网引领安全创新
  6. ansys如何删除线_绘画新手不懂如何用ps提取线稿?教你用PS提取自己喜欢的线稿!...
  7. 《代码大全》阅读心得二
  8. js时间搓化为今天明天_踩雷预警!爆款好物怎么都变成了“搓泥宝”?
  9. Facebook 发布全新 JavaScript 引擎:Hermes! | CSDN博文精选
  10. SDK里报错[NSConcreteMutableData wbsdk_base64EncodedString]
  11. jquery系列教程2-style样式操作全解
  12. 7 HandlerSet 处理程序链表类——Live555源码阅读(一)基本组件类
  13. Lightning 转 USB Type-A/Type-C 思路
  14. 解决SublimeText中文注释乱码
  15. hive分区表快速复制
  16. 用Python获取好看听书网中的《星期五有鬼》有声小说
  17. 蘑菇街的开源IM:TeamTalk
  18. 【PE结构】由浅入深PE基础学习-菜鸟手动查询导出表、相对虚拟地址(RVA)与文件偏移地址转换(FOA)...
  19. 关于IAP支付,谷歌和苹果订阅商品——最白话,手把手教你做系列。
  20. Axon Framework简介

热门文章

  1. 离人类更近一步!DeepMind最新Nature论文:AI会“回忆”,掌握调取记忆新姿势
  2. 对话英特尔研究院院长:量子计算是马拉松,现在大家(包括谷歌)刚跑出第一英里...
  3. 每张脸值5美元,谷歌花钱买数据强化刷脸,还把隔空操控手机变成现实
  4. iOS:MBProgressHUD的基本使用
  5. Linux存储入门:简易数据恢复方案--分区和LVM实战
  6. 是时候对XSLT说“Goodbye”了吗?
  7. (转)利用libcurl和国内著名的两个物联网云端通讯的例程, ubuntu和openwrt下调试成功(四)...
  8. 类与类之间 相同属性及字段拷贝
  9. 秋季4类疾病患者忌吃螃蟹
  10. 项目经理需要修炼的9件事