安装批处理:install.bat
@echo offecho net stop MySql57 sc delete MySql57 ::"%~dp0binmysqld.exe" --install MySql57 --defaults-file="my.ini" :: 生成Data目录 :: "%~dp0binmysqld.exe" --initialize "%~dp0binmysqld.exe" --install MySql57 net start MySql57
卸载批处理:uninstall.bat
@echo offecho net stop MySql57 sc delete MySql57
my.ini
[mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 #basedir=D:mysql-5.7.20-winx64 # 设置mysql数据库的数据的存放目录 #datadir=D:mysql-5.7.20-winx64data # 允许最大连接数 max_connections=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB # 重置密码 # use mysql # select user,host from user; # update mysql.user set authentication_string=PASSWORD('root') where User='root'; # alter user 'root'@'localhost' identified by 'root'; # 重置密码 # GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; #设置远程登录权限 # skip-grant-tables # MySQL全文索引查询关键词最小长度限制 ft_min_word_len=2 ngram_token_size=2 innodb_ft_min_token_size=1 sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' [client] ft_min_word_len=2
备份还原:
备份:"D:mysql-5.7.20-winx64inmysqldump.exe" -h127.0.0.1 -uroot -p --default-character-set=utf8 aaa > "E:akaaaa_mysqldump.sql"
还原: "D:mysql-5.7.20-winx64inmysql.exe" -h127.0.0.1 -uroot -p aaa < "E:akaaaa_20170724_mysqldump.sql"