1.從mysql官網下載免安裝版 mysql-5.7.12-winx64.ziphtml
2.解壓到本地目錄 如 (C:\software\mysql-5.7.12-winx64)mysql
3.添加mysql路徑到環境變量sql
4.在mysql目錄下建立data目錄ui
5.在mysql目錄下建立my.inithis
在[mysqld]下面配置 basedir 和 datadir,以及一些其餘的可選參數。命令行
# 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. [client] #default-character-set = utf8 [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 general_log=ON general_log_file="D:\logs\mysql.log" # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = ..... # port = ..... # server_id = ..... # 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 # The TCP/IP Port the MySQL Server will listen on port=3306 group_concat_max_len = 102400 #Path to installation directory. All paths are usually resolved relative to this. basedir="C:\Software\mysql-5.7.12-winx64" #Path to the database root datadir="C:\Software\mysql-5.7.12-winx64\data" # The default storage engine that will be used when create new tables when default-storage-engine=INNODB character_set_server = utf8 innodb_strict_mode = 0 #server-id=1 #log-bin=master-bin #log-bin-index=master-bin.index sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
6.以管理員身份啓動cmd命令行code
7.切換到mysql目錄的bin目錄下server
8.運行命令 mysqld --initialize-insecure --user=mysql htm
運行命令時確保 mysql5.7xxx/data/ 目錄是空的ip
9.運行命令 (安裝mysql服務) mysqld install
10.運行命令 (設置mysql是否能夠遠程) mysql_secure_installation.exe