下载 5.7.23 https://downloads.mysql.com/archives/community/
配置变量 变量名:MYSQL_HOME 变量值:D:\mysql5.7.23 path里添加:%MYSQL_HOME%\bin
创建目录
创建文件夹my.ini
[mysqld]
port=3306
character_set_server=utf8
basedir=D:\mysql5.7.23
datadir=D:\mysql5.7.23\data
server-id=1
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
lower_case_table_names=1
innodb_file_per_table = 1
log_timestamps=SYSTEM
log-error = error.log
slow_query_log = 1
slow_query_log_file = slow.log
long_query_time = 5
log-bin = binlog
binlog_format = row
expire_logs_days = 15
log_bin_trust_function_creators = 1
secure-file-priv=D:\mysql5.7.23\Uploads
[client]
default-character-set=utf8
进入mysql/bin目录下
- 执行初始化命令
mysqld --initialize-insecure - 注册mysql服务 (注意要用管理员打开cmd)
mysqld –install MySQL57 - 启动
net start MySQL57 - 修改密码
alter user 'root'@'localhost' identified by '123456'; - 用户远程访问
grant all privileges on *.* to 'root' @'%' identified by '123456' with grant option;
备份
rem auther:wang
rem date:20190526
rem ******MySQL backup start********
@echo off
forfiles /p "E:\MySQLdata_Bak\mysql_backup" /m backup_*.sql -d -7 /c "cmd /c del /f @path"
set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2%"
"D:\mysql5.7.23\bin\mysqldump" -uroot -p123456 -P3306 --default-character-set=utf8 -R -E --single-transaction --all-databases > "E:\MySQLdata_Bak\mysql_backup\backup_%Ymd%.sql"
@echo on
rem ******MySQL backup end********
|