MySQL5.7.20解凍版のインストール方法


  • MySQL公式サイトはmsiフォーマットのインストールパッケージを提供して、ダブルクリックしてインストールすることができて、msiインストールパッケージはリンクをダウンロードしますhttps://dev.mysql.com/downloads/installer/
  • 公式サイトはzip圧縮パッケージも提供しており、手動でインストールすることもできます.より緑の簡潔な緑版ダウンロードリンクhttps://dev.mysql.com/downloads/mysql/

  • まず注意します:圧縮パッケージのルートディレクトリの下で手動でdataフォルダを創立しないでください、下のコードは自動的にwin 10のためにできるだけCディスクの下に詰めないでください、多くの権限の誤りが現れるかもしれません、例えばDディスクの下でソフトウェアフォルダを建てて、それからこのフォルダの中にインストールすることができて、次の例はwin 7の下で操作したので、あなたは相応のパスを修正するべきですC:Program FilesMySQLをD:softwareに変更
    1.圧縮パッケージをC:Program FilesMySQLmysql-5.7.20-winx 64に解凍し、path環境変数を追加する:C:Program FilesMySQLmysql-5.7.20-winx 64;
    2.目次のC:Program FilesMySQLmysql-5.7.20-winx 64新規my.ini、メモ帳が開き、コードが書き込まれます.
    [client]  
    #no-beep  
    # pipe  
    # socket=mysql  
    port=3306   
    [mysql]
    default-character-set=utf8  
    
    # For advice on how to change settings please see  
    # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html  
      
    [mysqld]  
    explicit_defaults_for_timestamp = TRUE  
    
    # 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 = 2G  
     
    #     ,     
    basedir="C:\Program Files\mysql-5.7.26-winx64"  
    datadir="C:\Program Files\mysql-5.7.26-winx64\data\"  
    
    port=3306
    server_id=1  
    
    #      ,       
    #log-bin
    #expire_logs_days=10   #        
    #max_binlog_size=100M  #       100M
    
    #     
    #general-log=0  
    #general_log_file="mysql_general.log"  
    
    #      
    #slow-query-log=1  
    #slow_query_log_file="mysql_slow_query.log"  
    #long_query_time=10  
    
    #     
    #log-error="mysql_error_log.err"   
     
    default-storage-engine=INNODB  
    max_connections=1024 
     
    #      
    query_cache_type=1
    query_cache_size=128M
    
    key_buffer_size=128M  
    innodb_flush_log_at_trx_commit=1  
    innodb_thread_concurrency=128  
    innodb_autoextend_increment=128M  
    tmp_table_size=128M  
    
    # 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   
    sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"  
    character-set-server=utf8  
    innodb_flush_method=normal
    secure_file_priv=''
    #my.ini      
    

    3.cmdにcd C:\Program Files\MySQL\mysql-5.7.20-winx64\binを入力
    4.mysqld --initialize-insecureを入力これはパスワードなしrootユーザーログインです.このときcmdには何のヒントもありませんが、dataディレクトリは自動的に作成され、多くのフォルダとファイルが追加されています.エラーが発生した場合、cannote create directoryのエラーは、myを変更してください.iniプロファイル
    basedir="C:/Program Files/MySQL/mysql-5.7.20-winx64/"  #             
    datadir="C:/Program Files\MySQL/mysql-5.7.20-winx64/data/"  #      
    #        /   \           ,cannote create directory   
    

    5.入力mysqld -install自己起動サービスのインストール
    6.入力net start mysqlサービス開始
    7.mysql -u root -p空のパスワードを入力してログインする
    8.rootパスワードの変更
    use mysql;      Database changed
    UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
    
        Unknown column ‘password'   ,
       MySQL   password      authentication_string  
        
    update user set authentication_string=password('newpassword') where user=‘root';
    
    flush privileges;   
    

    9.完了し、mysql自己起動サービスを手動で設定できます.そうしないと、起動時間に影響します.