mysql学习之旅-数据库自动备份-测试环境搭建
Posted Yunier
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql学习之旅-数据库自动备份-测试环境搭建相关的知识,希望对你有一定的参考价值。
#终于知道什么叫不会走先会跑了,刚开始接触第一个case就是数据库自动备份,我可是都没安装过啊?! 发完牢骚开始干活
首先,因为业务已经上线,不能随便动,先搭建测试环境吧
规划一下
版本:mysql-5.7.14-winx64.zip 从官网下载
系统:windows 7 64bit
解压缩到本地目录 D:\\app\\mysql57 #注意,非系统盘,非中文
将my-default.ini 复制一份重命名为my.ini 添加如下内容,先保证能开启服务
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/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 = ..... # datadir = ..... # port = ..... # server_id = ..... basedir="D:\\app\\mysql57" datadir="D:\\app\\mysql57\\data" port=3306 max_connections=200 character-set-server=utf8 default-storage-engine=INNODB # 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
修改环境变量path,增加bin目录
在命令行中cd到bin, 输入mysqld -install MySQL --defaults-file="D:\\app\\mysql57\\my.ini" 添加服务
在命令行中输入初始化命令 .\\mysqld.exe --initialize 会生成data目录,并且生成初始的root密码 ,否则net start mysql 会无法开启服务 #新版本特殊要求
之后服务可以开启,从后缀为err的文件中取得密码
复制默认密码,使用默认密码登录mysql
必须使用命令先修改密码,否则啥也不让干
mysql> alter user \'root\'@\'localhost\' identified by \'redhat\';
Query OK, 0 rows affected (0.00 sec)
密码修改成功,可以查询数据库了
安装完成
---------
在此要感谢liongis 、卒子和另一位其他博客的朋友,谢谢你们分享的经验~
以上是关于mysql学习之旅-数据库自动备份-测试环境搭建的主要内容,如果未能解决你的问题,请参考以下文章