设为首页 收藏本站
查看: 725|回复: 0

[经验分享] Windows从noinstall zip安装MySQL免安装版

[复制链接]
发表于 2018-6-24 09:57:57 | 显示全部楼层 |阅读模式
  对于Windows的MySQL的安装其实很简单。个人推荐使用免安装版的MySQL,这种版本只要下来,解压缩后配置一下就可以使用了。而对那种安装包则就比较麻烦,本篇也不做介绍。因为周围有许多人的MySQL安装使用安装程序,而安装到一半,配置不会弄,MySQL数据库也弄的怪怪的。
第一步,下载MySQL的免安装版压缩包
  好了,对于MySQL的免安装程序,我们先要下载一个MySQL的压缩包。下载地址:MySQL官网下载或者腾讯旋风分享下载。
说明:在MySQL下载的时候,会有个让你login或sign up的按钮,不用注册了,看下方有个No thanks, just start my download.的链接。点击可直接下载,不用登录。  对于解压缩出来的MySQL,有几个配置文件样例,有my-small.ini、my-huge.ini等等,我们只要复制其中的一个,并命名为my.ini。
small、medium、large、huge、heavy的配置区别1234Small: System has Medium: System has at least 64MB memoryLarge: System has at least 512MB memory and the server will run mainly MySQL.Huge: System has at least 1GB memory and the server will run mainly MySQL.Heavy: System has at least 4GB memory and the server will run mainly MySQL.第二步,配置MySQL
  将第一步复制的配置文件my.ini打开,我们需要修改一下basedir(MySQL数据库的文件夹)和datadir(MySQL数据库的数据目录)。如下,
001002003004005006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054055056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089090091092093094095096097098099100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163# Example MySQL config file for medium systems.## This is for a system with little memory (32M - 64M) where MySQL plays# an important part, or systems up to 128M where MySQL is used together with# other programs (such as a web server)## You can copy this file to# /etc/my.cnf to set global options,# mysql-data-dir/my.cnf to set server-specific options (in this# installation this directory is C:\mysql\data) or# ~/.my.cnf to set user-specific options.## 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   = your_passwordport       = 3306socket     = /tmp/mysql.sock# Here follows entries for some specific programs# The MySQL server[mysqld]port       = 3306socket     = /tmp/mysql.sock#skip-lockingkey_buffer= 16Mmax_allowed_packet= 1Mtable_cache= 64sort_buffer_size= 512Knet_buffer_length= 8Kread_buffer_size= 256Kread_rnd_buffer_size= 512Kmyisam_sort_buffer_size= 8M# set basedir to your installation pathbasedir=E:/Program Files (x86)1/mysql-5.5.27-winx64# set datadir to the location of your data directorydatadir=E:/Program Files (x86)1/mysql-5.5.27-winx64/data# 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# Disable Federated by defaultskip-federated# Replication Master Server (default)# binary logging is required for replicationlog-bin=mysql-bin# required unique># defaults to 1 if master-host is not set# but will not function as a master if omittedserver-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># (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# Point the following paths to different dedicated disks#tmpdir     = /tmp/#log-update     = /path-to-dedicated-directory/hostname# Uncomment the following if you are using BDB tables#bdb_cache_size = 4M#bdb_max_lock = 10000# 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/#innodb_log_arch_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 = 16M#innodb_additional_mem_pool_size = 2M# Set .._log_file_size to 25 % of buffer pool>#innodb_log_file_size = 5M#innodb_log_buffer_size = 8M#innodb_flush_log_at_trx_commit = 1#innodb_lock_wait_timeout = 50[mysqldump]quickmax_allowed_packet= 16M[mysql]no-auto-rehash# Remove the next comment character if you are not familiar with SQL#safe-updates[isamchk]key_buffer= 20Msort_buffer_size= 20Mread_buffer= 2Mwrite_buffer= 2M[myisamchk]key_buffer= 20Msort_buffer_size= 20Mread_buffer= 2Mwrite_buffer= 2M[mysqlhotcopy]interactive-timeout  将这两处的地址换成自己的MySQL的地址,已经date目录。注意斜线的方向,使用E:/Program Files/mysql-5.5.27-winx64或者E:\\Program Files\\mysql-5.5.27-winx64。仅有这两处需要改动,其他不必改动了,除非特殊需要。
第三步,启动MySQL
  要启动MySQL也很简单,打开命令提示符。输入一下两个命令
12cd/dE:\Program Files\mysql-5.5.27-winx64\bin\mysqld --console  会出现一下内容就成功了。
010203040506070809101112131415130317 20:11:05 [Note] Plugin 'FEDERATED' is disabled.130317 20:11:05 InnoDB: The InnoDB memory heap is disabled130317 20:11:05 InnoDB: Mutexes and rw_locks use Windows interlocked functions130317 20:11:05 InnoDB: Compressed tables use zlib 1.2.3130317 20:11:05 InnoDB: Initializing buffer pool,>130317 20:11:05 InnoDB: Completed initialization of buffer pool130317 20:11:05 InnoDB: highest supported file format is Barracuda.130317 20:11:06  InnoDB: Waiting for the background threads to start130317 20:11:07 InnoDB: 1.1.8 started; log sequence number 14128205130317 20:11:07 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306130317 20:11:07 [Note]   - '0.0.0.0' resolves to '0.0.0.0';130317 20:11:07 [Note] Server socket created on IP: '0.0.0.0'.130317 20:11:07 [Note] Event Scheduler: Loaded 0 events130317 20:11:07 [Note] mysqld: ready for connections.Version: '5.5.27-log'  socket: ''  port: 3306  MySQL Community Server (GPL)  为了以后的方便,将里面的内容保存到startmysql.bat文件里,以后只要双击bat就可以运行mysql了。
第四步:更改MySQL密码
  默认MySQL的root密码为空的,在某些地方,密码不能输入为空,所以需要更改密码。
  首先先启动MySQL数据库,可以使用上面的bat启动MySQL。
  然后根据下面的命令进行更改
1234mysql -u root -p #从命令行中进入mysql的客户端use mysql;  #使用mysql这个数据库update user setpassword=password("root") where user="root";#对root密码进行更改FLUSH PRIVILEGES; #刷新一下权限安装到Windows service服务开机自动启动
  如果需要将MySQL开机自动运行,并且以服务的形式存在,那么按照本方法进行即可。以服务的形式打开MySQL,就不用再适用上面的批处理文件了。
  先停止MySQL Server的运行。以管理员方式运行命令提示符
向WINDOWS添加服务
12E:\Program Files\mysql-5.5.27-winx64\bin>mysqld --install MySQL5.5Service successfully installed.  使用mysqld 并使用参数--install MySQL5.5,说明向服务注册一个叫MySQL5.5的服务名,如果不加服务名,则使用默认的MySQL作为服务名。
注意:使用--install 参数添加的服务为开机自动启动的。如果想要使用手工启动,那么使用参数--install-manual代替。命令mysqld --install-manual添加服务,需要手工启动服务。启动MYSQL服务
  第二步只是向Windows服务添加了一个MySQL5.5的服务,但是并没有启动。可以到Windows服务里启动,或者使用命令行(需要管理员权限)
123C:\> net start MySQL5.5MySQL5.5 服务正在启动 .MySQL5.5 服务已经启动成功。从服务中停止MYSQL服务
123C:\> net stop MySQL5.5MySQL5.5 服务正在停止.MySQL5.5 服务已成功停止。删除WINDOWS的MYSQL服务
12E:\Program Files\mysql-5.5.27-winx64\bin>mysqld --remove MySQL5.5Service successfully removed.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-529892-1-1.html 上篇帖子: VS2012中 未能正确加载”Microsoft.VisualStudio.Editor.Implementation.EditorPackate“包错误解决 下篇帖子: MRTG windows版本安装指南
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表