跳至正文
-
收藏很文博客的最新网址 www.hw97.com,不错过任何精彩内容。
很文博客 很文博客 很文博客

生活点滴 贵在分享

很文博客 很文博客 很文博客

生活点滴 贵在分享

  • 首页
  • 站务联系
  • 首页
  • 站务联系
关

搜索

数据库

绿色版 mysql 安装配置

2018年6月12日
0

好多朋友对于mysql的配置不是很清楚,其实最新本的配置也是这样的,建议大家到s.jb51.net去下载一些服务器软件。

一、下载MySQL

http://www.mysql.org/downloads

我下载的是mysql-noinstall-5.0.67-win32.zip

二、安装过程

1、解压缩 mysql-noinstall-5.0.67-win32.zip 到一个C盘,重新命名为 MySQL5 。
假定MYSQL_HOME=C:\ MySQL5

2、编辑mysql的运行配置文件my.ini,如果没有,可以拿my-medium.ini复制然后更名成 my.ini

  1. # Example MySQL config file for medium systems.
  2. #
  3. # This is for a system with little memory (32M - 64M) where MySQL plays
  4. # an important part, or systems up to 128M where MySQL is used together with
  5. # other programs (such as a web server)
  6. #
  7. # You can copy this file to
  8. # /etc/my.cnf to set global options,
  9. # mysql-data-dir/my.cnf to set server-specific options (in this
  10. # installation this directory is C:\mysql\data) or
  11. # ~/.my.cnf to set user-specific options.
  12. #
  13. # In this file, you can use all long options that a program supports.
  14. # If you want to know which options a program supports, run the program
  15. # with the "--help" option.
  16. # The following options will be passed to all MySQL clients
  17. [client]
  18. #password   = your_password
  19. port        = 3306
  20. socket      = /tmp/mysql.sock
  21. # Here follows entries for some specific programs
  22. # The MySQL server
  23. [mysqld]
  24. basedir = "C:\MySQL5"
  25. datadir = "C:\MySQL5\data"
  26. default-character-set=utf8
  27. port        = 3306
  28. socket      = /tmp/mysql.sock
  29. skip-locking
  30. key_buffer = 16M
  31. max_allowed_packet = 1M
  32. table_cache = 64
  33. sort_buffer_size = 512K
  34. net_buffer_length = 8K
  35. read_buffer_size = 256K
  36. read_rnd_buffer_size = 512K
  37. myisam_sort_buffer_size = 8M
  38. # Don't listen on a TCP/IP port at all. This can be a security enhancement,
  39. # if all processes that need to connect to mysqld run on the same host.
  40. # All interaction with mysqld must be made via Unix sockets or named pipes.
  41. # Note that using this option without enabling named pipes on Windows
  42. # (via the "enable-named-pipe" option) will render mysqld useless!
  43. #
  44. #skip-networking
  45. # Disable Federated by default
  46. skip-federated
  47. # Replication Master Server (default)
  48. # binary logging is required for replication
  49. log-bin=mysql-bin
  50. # required unique id between 1 and 2^32 - 1
  51. # defaults to 1 if master-host is not set
  52. # but will not function as a master if omitted
  53. server-id   = 1
  54. # Replication Slave (comment out master section to use this)
  55. #
  56. # To configure this host as a replication slave, you can choose between
  57. # two methods :
  58. #
  59. # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
  60. #    the syntax is:
  61. #
  62. #    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
  63. #    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
  64. #
  65. #    where you replace <host>, <user>, <password> by quoted strings and
  66. #    <port> by the master's port number (3306 by default).
  67. #
  68. #    Example:
  69. #
  70. #    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
  71. #    MASTER_USER='joe', MASTER_PASSWORD='secret';
  72. #
  73. # OR
  74. #
  75. # 2) Set the variables below. However, in case you choose this method, then
  76. #    start replication for the first time (even unsuccessfully, for example
  77. #    if you mistyped the password in master-password and the slave fails to
  78. #    connect), the slave will create a master.info file, and any later
  79. #    change in this file to the variables' values below will be ignored and
  80. #    overridden by the content of the master.info file, unless you shutdown
  81. #    the slave server, delete master.info and restart the slaver server.
  82. #    For that reason, you may want to leave the lines below untouched
  83. #    (commented) and instead use CHANGE MASTER TO (see above)
  84. #
  85. # required unique id between 2 and 2^32 - 1
  86. # (and different from the master)
  87. # defaults to 2 if master-host is set
  88. # but will not function as a slave if omitted
  89. #server-id       = 2
  90. #
  91. # The replication master for this slave - required
  92. #master-host     =   <hostname>
  93. #
  94. # The username the slave will use for authentication when connecting
  95. # to the master - required
  96. #master-user     =   <username>
  97. #
  98. # The password the slave will authenticate with when connecting to
  99. # the master - required
  100. #master-password =   <password>
  101. #
  102. # The port the master is listening on.
  103. # optional - defaults to 3306
  104. #master-port     =  <port>
  105. #
  106. # binary logging - not required for slaves, but recommended
  107. #log-bin=mysql-bin
  108. # Point the following paths to different dedicated disks
  109. #tmpdir     = /tmp/
  110. #log-update     = /path-to-dedicated-directory/hostname
  111. # Uncomment the following if you are using BDB tables
  112. #bdb_cache_size = 4M
  113. #bdb_max_lock = 10000
  114. # Uncomment the following if you are using InnoDB tables
  115. #innodb_data_home_dir = C:\mysql\data/
  116. #innodb_data_file_path = ibdata1:10M:autoextend
  117. #innodb_log_group_home_dir = C:\mysql\data/
  118. #innodb_log_arch_dir = C:\mysql\data/
  119. # You can set .._buffer_pool_size up to 50 - 80 %
  120. # of RAM but beware of setting memory usage too high
  121. #innodb_buffer_pool_size = 16M
  122. #innodb_additional_mem_pool_size = 2M
  123. # Set .._log_file_size to 25 % of buffer pool size
  124. #innodb_log_file_size = 5M
  125. #innodb_log_buffer_size = 8M
  126. #innodb_flush_log_at_trx_commit = 1
  127. #innodb_lock_wait_timeout = 50
  128. [mysqldump]
  129. quick
  130. max_allowed_packet = 16M
  131. [mysql]
  132. no-auto-rehash
  133. # Remove the next comment character if you are not familiar with SQL
  134. #safe-updates
  135. [isamchk]
  136. key_buffer = 20M
  137. sort_buffer_size = 20M
  138. read_buffer = 2M
  139. write_buffer = 2M
  140. [myisamchk]
  141. key_buffer = 20M
  142. sort_buffer_size = 20M
  143. read_buffer = 2M
  144. write_buffer = 2M
  145. [mysqlhotcopy]
  146. interactive-timeout

[mysqld]
# 设置mysql的安装目录
basedir=$MYSQL_HOME
# 设置mysql数据库的数据的存放目录,必须是data,或者是\\xxx\data
datadir=$MYSQL_HOME\data
# 设置mysql服务器的字符集
default-character-set=utf8

[client]
# 设置mysql客户端的字符集
default-character-set=gbk

3、安装mysql服务
从MS-DOS窗口进入目录E:\myserver\mysql-5.0.37-win32\bin,运行如下命令:
mysqld --install mysql --defaults-file=C:\MySQL5\my.ini

4、启动mysql数据库
还在上面的命令窗口里面,输入命令:net start mysql
这样就启动了mysql 服务。

5、停止服务
执行 net stop mysql 即可
6、删除服务
执行mysqld --remove mysql 即可

7、修改密码
以上安装完毕之后,默认的root用户密码为空的。为了安全起见,需要设置一个root用户的密码。

  1. <STRONG><SPAN style="COLOR: #ffffff" style="COLOR: #ffffff">C:\>cd MySQL5
  2. C:\MySQL5>cd bin
  3. C:\MySQL5\bin>mysql -uroot -p
  4. Enter password:
  5. Welcome to the MySQL monitor.  Commands end with ; or \g.
  6. Your MySQL connection id is 3
  7. Server version: 5.0.67-community-log MySQL Community Edition (GPL)
  8. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  9. mysql> use mysql
  10. Database changed
  11. mysql> update User set Password=PASSWORD('admin') where User='root';
  12. Query OK, 2 rows affected (0.08 sec)
  13. Rows matched: 2  Changed: 2  Warnings: 0</SPAN>
  14. </STRONG>

标签:

MySQL安装配置
作者

很文博客

关注我
其他文章
上一个

mysql 数据库设计

下一个

mysql 中文乱码 解决方法大全

暂无评论!成为第一个。

发表回复 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注

近期浏览最多文章

  • 作品观看平台+科学上网工具(不定期更新……) - 5,816 浏览
  • 「博多彩叶」出道作品番号及封面,「博多彩叶」个人简介 - 2,261 浏览
  • 「河北彩伽」最新作品SNOS-056介绍及封面预览 - 2,086 浏览
  • 森日向子(Mori-Hinako)最新作品MIAB-021介绍及封面预览 - 1,928 浏览
  • 「河北彩伽」最新作品SNOS-003介绍及封面预览 - 1,779 浏览

热门标签

Julia miru MySQL 三上悠亚 三上悠亜 习惯 伊藤舞雪 传奇故事 动物故事 励志名言 励志故事 危机故事 哲学哲理 哲理小语 哲理故事 寓言故事 小花のん 小花暖 希腊寓言故事 帝王故事 心情说说 惊险故事 战争故事 明里つむぎ 明里䌷 松本いちか 枫富爱 桃乃木かな 桃乃木香奈 桜空もも 梦乃あいか 樱空桃 欢迎词 河北彩花 波多野结衣 生日祝福语 生活小语 祝福短信 祝福语 神宫寺ナオ 神宫寺奈绪 童话故事 美谷朱里 自然人文 藤森里穂
Copyright 2026 — 很文博客. All rights reserved. Sitemap |站务联系 |备用网址