博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[MySQL] 安装与配置
阅读量:2341 次
发布时间:2019-05-10

本文共 2529 字,大约阅读时间需要 8 分钟。

  • 使用解压缩版的mysql

  • 配置

MYSQL_HOME=E:\mysql-5.7.18-winx64

添加PATH:

Path=%MYSQL_HOME%\bin
  • mysql-5.6.1X默认的配置文件在C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini,或者自己建立一个my.ini文件,

里面的内容如下:(要更换其中的basedirdatadir

[client]  no-beep  # pipe  # socket=mysql  port=3306   [mysql]  default-character-set=utf8  # 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]  explicit_defaults_for_timestamp = TRUE  # 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 = 2G  # 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="E:\mysql-5.7.18-winx64\"  datadir="F:\mysql_data\"  port=3306  server_id=1  general-log=0  general_log_file="mysql_general.log"  slow-query-log=1  slow_query_log_file="mysql_slow_query.log"  long_query_time=10  log-error="mysql_error_log.err"    default-storage-engine=INNODB  max_connections=1024  query_cache_size=128M  key_buffer_size=128M  innodb_flush_log_at_trx_commit=1  innodb_thread_concurrency=128  innodb_autoextend_increment=128M  tmp_table_size=128M  # 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   sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"  character-set-server=utf8  innodb_flush_method=normal
  • 打开命令提示符以管理员身份运行,cd到E:\mysql-5.7.18-winx64\bin下

  • 安装MySQL(其中的MySQL是安装服务器的名称,可以指定任何名称)

mysqld --install MySQL --defaults-file="E:\mysql-5.7.18-winx64\my.ini"

如果出现

The service already exists!
The current server installed: E:\mysql-5.7.18-winx64\bin\mysqld MySQL
则移除原先的服务:

mysqld -remove MySQL

并且清除data目录下的所有数据

安装成功后会在系统的服务组策中添加该服务,在使用时只需要开启即可。

  • 初始化数据库data,(不执行无法启动mysql)
mysqld --initialize-insecure --user=root(任意的用户名)
  • 启动MySQL服务:
net start mysql
值得注意的是用命令安装的MySQL在Windows系统下默认服务名为mysql,默认密码为空。
  • 进入MySQL,密码默认为空:
mysql -u root -p

显示mysql>表示进入MySQL

转载地址:http://zokvb.baihongyu.com/

你可能感兴趣的文章
详解HDR的三个标准——HLG/HDR10/Dolby Vision
查看>>
流言终结者 1080P全高清都等于高画质?
查看>>
PSNR指标值
查看>>
灰度图像-图像增强 中值滤波
查看>>
两种HDR格式(HLG, HDR10)的理解
查看>>
视频主观质量对比工具(Visual comparision tool based on ffplay)
查看>>
HDMI 接口及CEC信号
查看>>
H.264专利介绍
查看>>
YUV格式小结
查看>>
log4j2.xml实用例子
查看>>
Dockerfile中的CMD和ENTRYPOINT有什么区别?
查看>>
jQuery提示和技巧
查看>>
是否可以在Python中将长行分成多行[重复]
查看>>
命令行上的Node.js版本? (不是REPL)
查看>>
你什么时候使用Builder模式? [关闭]
查看>>
在jQuery中每5秒调用一次函数的最简单方法是什么? [重复]
查看>>
Angular 2+中的ngShow和ngHide等效于什么?
查看>>
如何将Java String转换为byte []?
查看>>
@Transactional注释在哪里?
查看>>
找不到Gradle DSL方法:'runProguard'
查看>>