一.从地址http://dev.mysql.com/downloads/mysql/中选择windows的版本下载。
二.mysql各个版本的简介
- MySQL Community Server 社区版本,开源免费,但不提供官方技术支持。
- MySQL Enterprise Edition 企业版本,需付费,可以试用30天。
- MySQL Cluster 集群版,开源免费。可将几个MySQL Server封装成一个Server。
- MySQL Cluster CGE 高级集群版,需付费。
- MySQL Workbench(GUITOOL)一款专为MySQL设计的ER/数据库建模工具。它是著名的数据库设计工具DBDesigner4的继任者。MySQLWorkbench又分为两个版本,分别是社区版(MySQL Workbench OSS)、商用版(MySQL WorkbenchSE)。
- MySQL Community Server开源免费,这是我们通常用的MySQL的版本。
三.解压出下载的文件(有x86和x64两个版本)到目录,防止出现未知问题,最好放在非系统盘的非中文目录下,我的安装目录是D:\mysql。
四.将素材中的my.ini文件拷贝到D:\mysql目录中,修改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:\mysql
datadir = d:\mysql\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
…..
- 五..在window系统注册mysql服务
(1)开始——运行——cmd,然后cd到mysql安装目录的bin下面,我的目录就是“D:\mysql”,然后执行mysqld -install,提示服务安装成功。
如果想要卸载服务,需要执行mysqld –remove。
(2)运行services.msc一看,确实有一个名为MySQL的服务,直接启动它。
或者使用net start mysql 启动,
如果要停止服务,可以使用 net stop mysql。
六.登录数据库服务器进行维护和管理(DBA)
- 安装成功了,也启动了,怎么登录啊?用户名和密码是什么?
- MySQL的默认用户名是root,密码为空。
- 怎么登录?在命令行执行“mysql -u root -p”,提示输入密码,由于第一次运行,密码为空可以直接回车。
- 还是给数据库设个密码吧。在命令窗口运行mysqladmin –u root -p password <新密码> ,将<新密码>替换为你的自定义密码,然后按回车。这时会提示输入密码,其实是指的原密码,输入正确的原密码再回车即可完成设置。然后用新密码登入mysql,即可正常工作。 七.显示版本信息 1.登录服务器后,输入命令show variables like '%version%',显示如下信息
2.显示目前已经创建的数据库
八.安装和配置成功