mysql 安裝配置

安裝批處理:install.batmysql

@echo offecho 

net stop MySql57

sc delete MySql57 

::"%~dp0bin\mysqld.exe" --install MySql57 --defaults-file="my.ini"

:: 生成Data目錄
:: "%~dp0bin\mysqld.exe" --initialize

"%~dp0bin\mysqld.exe" --install MySql57 

net start MySql57

 卸載批處理:uninstall.batsql

@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-winx64\data
# 容許最大鏈接數
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

備份還原:ide

備份:"D:\mysql-5.7.20-winx64\bin\mysqldump.exe" -h127.0.0.1 -uroot -p --default-character-set=utf8 aaa > "E:\bak\aaaa_mysqldump.sql"編碼


還原: "D:\mysql-5.7.20-winx64\bin\mysql.exe" -h127.0.0.1 -uroot -p aaa < "E:\bak\aaaa_20170724_mysqldump.sql"spa

相關文章
相關標籤/搜索