扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
首先是下载 mysql-installer-community-5.6.14.0.msi ,大家可以到 mysql 官方网去下载。
创新互联专注为客户提供全方位的互联网综合服务,包含不限于网站建设、成都网站设计、昌平网络推广、微信平台小程序开发、昌平网络营销、昌平企业策划、昌平品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供昌平建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com
win10的安全机制比较严格,安装前最好到设置--更新和安全--针对开发人员 选择 《开发人员模式》
下载好 mysql 安装文件之后就对它进行运行安装,运行之后就会出现如下的安装界面。
3
当加载完成之后就到了 MySQL install 的安装的欢迎界面了,在这里有几个选项,下面的两项别管,点击“Install MySQL Products”就行了。
4
这时安装步骤来到了使用协议的地方的,全是英文,别管,再看我们也不懂,看重点就行了。
在“I accept the license terms”(我接受许可条款)的前面给打上勾,然后点击右下边的“Next”(下一步)来进行下一步的操作。
5
这一步是要求我们在安装前先检查是否有新的版本,在这里我们选择跳过吧,不用检查了,浪费时间,如果你觉得有必要也可以对新版本进行检查。
在“Skip ths check for updates (not recommended)”(跳过这个检查更新(不推荐))前给打上勾,然后点击“Next”(下一步)来进行下一步的操作。
1、解压缩,比如到d:\,为了方便,改一下路径,比如mysql
2、开始/运行,输入cmd,回车进入命令行
d:
cd mysql\bin
安装mysql服务
mysqld.exe --install (默认服务名称是mysql或者mysqld.exe --install "mysql5"修改服务名称)
删除mysql服务
mysqld.exe --remove(或者mysqld.exe --remove "mysql5")
3、ini参数配置文件d:\mysql\
复制mysql-small.ini为my.ini
4、启动停止服务
a)在命令行启动/停止
net start mysql
net stop mysql
b)或者去控制面板找服务启动
c)或者开始/运行输入services.msc,确定后,找到mysql启动
1、 MySQL Community Server 5.6.10
2、解压到d:\MySQL.(路径自己指定)
3、在d:\MySQL下新建my.ini配置文件,内容如下:
*****************配置文件开始*********************
# MySQL Server Instance Configuration File
#----------------------------------------------------------------------
# Generated by the MySQL Server Instance ConfigurationWizard
#
#
# Installation Instructions
#----------------------------------------------------------------------
#
#
# CLIENT SECTION
#----------------------------------------------------------------------
#
# The following options will be read by MySQL clientapplications.
# Note that only client applications shipped by MySQLare guaranteed
# to read this section. If you want your own MySQLclient program to
# honor these values, you need to specify it as anoption during the
# MySQL client library initialization.
#
[client]
port=3306
[mysql]
default-character-set=gbk
# SERVER SECTION
#----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server.Make sure that
# you have installed the server correctly (see above)so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usuallyresolved relative to this.
basedir="d:\MySQL\"
#Path to the database root
datadir="d:\MySQL\Data"
[WinMySQLadmin]
Server="d:\MySQL\bin\mysqld.exe"
# The default character set that will be used when anew schema or table is
# created and no character set is defined
default-character-set=gbk
# The default storage engine that will be used whencreate new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# The maximum amount of concurrent sessions the MySQLserver will
# allow. One of these connections will be reserved fora user with
# SUPER privileges to allow the administrator to logineven if the
# connection limit has been reached.
max_connections=100
# Query cache is used to cache SELECT results andlater return them
# without actual executing the same query once again.Having the query
# cache enabled may result in significant speedimprovements, if your
# have a lot of identical queries and rarely changingtables. See the
# "Qcache_lowmem_prunes" status variable tocheck if the current value
# is high enough for your load.
# Note: In case your tables change very often or ifyour queries are
# textually different every time, the query cache mayresult in a
# slowdown instead of a performance improvement.
query_cache_size=0
# The number of open tables for all threads.Increasing this value
# increases the number of file descriptors that mysqldrequires.
# Therefore you have to make sure to set the amount ofopen files
# allowed to at least 4096 in the variable"open-files-limit" in
# section [mysqld_safe]
table_cache=256
# Maximum size for internal (in-memory) temporarytables. If a table
# grows larger than this value, it is automaticallyconverted to disk
# based table This limitation is for a single table.There can be many
# of them.
tmp_table_size=26M
# How many threads we should keep in a cache forreuse. When a client
# disconnects, the client's threads are put in thecache if there aren't
# more than thread_cache_size threads frombefore. This greatly reduces
# the amount of thread creations needed if you have alot of new
# connections. (Normally this doesn't give a notableperformance
# improvement if you have a good threadimplementation.)
thread_cache_size=8
#*** MyISAM Specific options
# The maximum size of the temporary file MySQL isallowed to use while
# recreating the index (during REPAIR, ALTER TABLE orLOAD DATA INFILE.
# If the file-size would be bigger than this, theindex will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creationwould be bigger
# than using the key cache by the amount specifiedhere, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method tocreate the index.
myisam_sort_buffer_size=52M
# Size of the Key Buffer, used to cache index blocksfor MyISAM tables.
# Do not set it larger than 30% of your available memory,as some memory
# is also required by the OS to cache rows. Even ifyou're not using
# MyISAM tables, you should still set it to 8-64M asit will also be
# used for internal temporary disk tables.
key_buffer_size=40M
# Size of the buffer used for doing full table scansof MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K
# This buffer is allocated when MySQL needs to rebuildthe index in
# REPAIR, OPTIMZE, ALTER table statements as well asin LOAD DATA INFILE
# into an empty table. It is allocated per thread sobe careful with
# large settings.
sort_buffer_size=256K
#*** INNODB Specific options ***
innodb_data_home_dir="d:\MySQL\Data\INNODB\"
# Use this option if you have a MySQL server withInnoDB support enabled
# but you do not plan to use it. This will save memoryand disk space
# and speed up some things.
#skip-innodb
# Additional memory pool that is used by InnoDB tostore metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not needto change this
# value. SHOW INNODB STATUS will display the currentamount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) thetransaction logs to the
# disk at each commit, which offers full ACIDbehavior. If you are
# willing to compromise this safety, and you arerunning small
# transactions, you may set this to 0 or 2 to reduce diskI/O to the
# logs. Value 0 means that the log is only written tothe log file and
# the log file flushed to disk approximately once persecond. Value 2
# means the log is written to the log file at eachcommit, but the log
# file is only flushed to disk approximately once persecond.
innodb_flush_log_at_trx_commit=1
# The size of the buffer InnoDB uses for buffering logdata. As soon as
# it is full, InnoDB will have to flush it to disk. Asit is flushed
# once per second anyway, it does not make sense tohave it very large
# (even with long transactions).
innodb_log_buffer_size=1M
# InnoDB, unlike MyISAM, uses a buffer pool to cacheboth indexes and
# row data. The bigger you set this the less disk I/Ois needed to
# access data in tables. On a dedicated databaseserver you may set this
# parameter up to 80% of the machine physical memorysize. Do not set it
# too large, though, because competition of thephysical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory perprocess, so do not
# set it too high.
innodb_buffer_pool_size=77M
# Size of each log file in a log group. You should setthe combined size
# of log files to about 25%-100% of your buffer poolsize to avoid
# unneeded buffer pool flush activity on log fileoverwrite. However,
# note that a larger logfile size will increase thetime needed for the
# recovery process.
innodb_log_file_size=39M
# Number of threads allowed inside the InnoDB kernel.The optimal value
# depends highly on the application, hardware as wellas the OS
# scheduler properties. A too high value may lead tothread thrashing.
innodb_thread_concurrency=8
*****************配置文件结束*********************
配置文件也放在了附件里,大家可以根据需要修改。
重点是以下配置,其中datadir的目录名称必须是data,并且好像必须是MySQL目录下的data.之前自己制定了其他目录,一直出现1067的错误。
#Path to installation directory. All paths are usuallyresolved relative to this.
basedir="d:\MySQL\"
#Path to the database root
datadir="d:\MySQL\Data"
4、在windows环境变量里加入以下内容(方便执行命令行命令)
新建MYSQL_HOME="d:\MySQL\"
在Path里加入%MYSQL_HOME%\bin
5、将mysql注册为windows系统服务。具体操作是在命令行中执行以下命令:
mysqld install MySQL --defaults-file="d:\MySQL\my.ini"
移除服务为 mysqld remove
6、第5步成功后,在命令行启动mysql
c:net start mysql
7、修改root的密码为62386997
方法一:
c:mysql –uroot
mysqlshowdatabases;
mysqluse mysql;
mysql UPDATE user SET password=PASSWORD("62386997") WHEREuser='root';
mysql FLUSH PRIVILEGES;
mysql QUIT
在进入到官网下载的时候,我们会发现官网上提供了很多类型的版本,它们到底是什么意思,哪个才是我们需要的呢?下面就来简单介绍下常见的,如下:
1、MySQL Enterprise Edition: Mysql企业版本,包含了最新的特性和管理工具,以及可以提供技术支持( 但是是要收费 )。
2、MySQL Cluster CGE: 一个用于高吞吐量快速、稳定的访问数据的开源事务数据库,它包含了MySQL Cluster、MySQL Enterprise Edition、MySQL Cluster Manager的功能。
3、MySQL Community (GPL) :遵循GPL开源协议的MySQL版本,平常我们使用的大多数遵循这个协议下的社区版
4、MySQL Installer : 是一个安装管理程序,因为MySQL家族包括了许多产品,所以提供了一个统一管理下载的工具。
5、MySQL Community Server : MySQL Community (GPL)下的开源社区版本,是使用的数据库开源版本( 免费的,盘它 )。
6、Mysql Workbench : 类似navicat是个图形界面UI工具,可以实现远程Mysql数据库访问(一开始不建议直接使用图形化管理工具,建议先通过命令行了解,这样能够更快的认识Mysql, 高手都是用命令行的 (PS: 如有需要图形化工具的可以私我))。
到官网下载自己需要的版本()或者直接到云盘下载(私信我,这种方式更快),下载步骤如下:
1、进入MySQL官网 =》选择“DOWNLOADS”选项 =》 点击MySQL Community (GPL) Downloads »
2、根据自己的需要选择“MySQL Community Server(不带图形化界面-推荐)”或者MySQL Workbench(带图形化界面的)
3、下载安装包(32位电脑下载32位的安装包,64位电脑下载64位的安装包)
4、解压下载好的安装包
5、配置环境变量
环境变量: 指的是当你在命令行属于任意一个值时,win系统会去环境变量池中匹配,如果有匹配到可执行的路径,则直接去对应的路径下进行执行 。
如你输入mysql,然后你在环境变量中配置了你安装的MySQL路径为:D:mysql8.xbin,则系统会匹配成D:mysql8.xbinmysql,如果这个目录下有这个可执行文件,则运行,具体步骤如下:。
1、启动MySQL服务器,并进行登录
2、如果发现MySQL服务无法启动,则进行下面的配置即可
(1)、在mysql压缩的路径中添加以下my.ini文件,内容如下(把其中的两处工作路径改为自己的按照路径即可):
(2)、执行执行 mysqld --initialize-insecure 指令进行配置,安装路径会默认生成一个data文件夹,如下:
3、输入mysqld --install将mysql注册到Window服务中,如果提示已经存在则跳过
4、启动mysql服务:net start mysql
5、连接Mysql服务: mysql -u root -p 回车(默认密码为空,输入密码时直接回车即可,为了安全性,记得修改密码哦),到此Mysql安装完成,可以随便操作了!
6、修改密码,分为MySQL5.x版本和8.x版本,步骤如下:
(1)、选中mysql数据库: use mysql
(2)、修改root用户的密码
不积跬步,无以至千里;不积小流,无以成江海。今天播种努力的种子,总会有一天发芽!
下载MySQL Community Server 5.6.13
解压MySQL压缩包
将以下载的MySQL压缩包解压到自定义目录下,我的解压目录是:
"D:\Program Files\MySQL\mysql-5.6.13-win32"
添加环境变量
操作如下:
1)右键单击我的电脑-属性-高级系统设置(高级)-环境变量
点击系统变量下的新建按钮
输入变量名:MYSQL_HOME
输入变量值:D:\Program Files\mysql-5.6.11-winx64
#即为mysql的自定义解压目录。
2)选择系统变量中的Path
点击编辑按钮
在变量值中添加变量值:%MYSQL_HOME%\bin
注意是在原有变量值后面加上这个变量,用;隔开,不能删除原来的变量值,
MySQL是一个跨平台开源的关系型数据库管理系统,多用于中小型网站或系统的开发。软件开发使用数据库技术可以方便实现数据的共享,减少数据的冗余,也方便统一对数据进行操作和控制。MySQL相对于Oracle、DB2等大型数据库具有体积小、速度快、成本低的特点,这些特性使得MySQL在开源世界大受欢迎。下面我带领大家去学习mySQL的下载及安装。
工具/材料
Windows 操作系统
MySQL有两个不同的版本, MySQL Community Server 是免费的社区版,MySQL Enterprice Server是企业版服务器,该版本需要付费,官方会提供技术支持。小型的软件开发或者自己学习使用,我们下载免费的社区版即可。我们在搜狗搜索框中输入mysql官网,进入到如下的页面,点击DOWNLOADS--Community。
我们在跳转的页面选择MySQL Community Downloads下方的DOWNLOAD按钮,选择Windows版本的安装包,我们选择MSI格式的安装包,点击Go to Download按钮,如下图所示。安装包只能选择32位的,即便本机是64位的操作系统也没有关系,图中有两个安装版本,第一个版本在线安装,第二个下载的版本离线安装。我们在安装的过程中不需要登录,选择No thanks, just start my download。
安装包下载完成后,我们点击右键进行安装,安装过程中License Agreement选择I accept the licence terms。安装类型选择Server only,执行过程如下图所示。
安装过程中,我们可以看到默认端口号是3306,接下来我们需要输入密码,密码不要设置太弱。安装过程中我们勾选开机自启动,如下图所示。执行安装我们选择Execute,然后便是开始等待安装即可。
安装完成后,我们找到本机的MySQL的客户端工具,这是一个命令行工具,可以执行sql命令,但不能用于复杂的开发工作,使用这个工具可以帮我们快速入门mysql数据库。
我们打开这个客户端软件,输入完密码后,便可以看到光标处的mysql, 输入show databases可以看到默认的数据库有哪些。其他的sql命令也很多,我们便不再一一列举了。
特别提示
安装过程中可能会提示Microsoft Visual C++ 2015 没有安装之类的,我们在线等待安装完成即可,这个时间可能有点久,请耐心等待。
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流