Installing mysql-5.7.12-winx64

Source: Internet
Author: User
Tags change settings

Before the installation of MySQL did not summarize, new computers, repair the installation record, installation, found some users of the installation records, found a lot of pits

1, Mysql-5.7.12-winx64.zip download

Official: http://dev.mysql.com/downloads/mysql/

2. Unzip to C:\job\mysql-5.7.12-winx64

3. Create a new My.ini configuration file under C:\job\mysql-5.7.12-winx64

The contents are as follows:

################### #配置文件开始 ################### # for advice in how to change settings. See # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # * * * Don't EDIT this FILE. It's a template which'll be copied to the # * * * * default location during install, and'll be replaced if you # * * * Upgra De to a newer version of MySQL. [Client] Default-character-set=utf8 [mysqld] port=3306 basedir = "c:\job\mysql-5.7.12-winx64/"DataDir = "c:\job\mysql-5.7.12-winx64/data/"Tmpdir = "c:\job\mysql-5.7.12-winx64/data/" socket = "C:\job\mysql-5.7.12-winx64/data/mysql.sock" log-error= "C:\job\ Mysql-5.7.12-winx64/data/mysql_error.log "#server_id = 2 #skip-locking max_connections=100 table_open_cache=256 Query _cache_size=1m tmp_table_size=32m thread_cache_size=8 innodb_data_home_dir= "c:\job\mysql-5.7.12-winx64/data/" Innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128m innodb_buffer_pool_size=128m innodb_log_file_size= 10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M Read_ Rnd_buffer_size = 32M Max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode= "STRICT_TRANS_TABLES,NO_ Auto_create_user,no_engine_substitution "

Skip-grant-tables #sql_mode =no_engine_substitution,strict_trans_tables################### #配置文件结束 ############### ####

The focus is the following configuration, where the directory name of DataDir must be: c:\job\mysql-5.7.12-winx64/data/, plus skip-grant-tables, so that Root does not lose the password, login

4. In the Windows System environment variable path, add the following:

C:\job\mysql-5.7.12-winx64\bin; (note plus semicolon)

5. Registering MySQL as a Windows system service

To do this, execute the following command on the command line (you need to run the command line as an administrator):

CD C:\Windows\System32
Run as Administrator cmd.exe

You need to switch to the bin directory, otherwise the service directory will be specified as C:\job\mysql-5.7.12-winx64\bin

Add Service command: mysqld install MySQL--defaults-file= "C:\job\mysql-5.7.12-winx64\my.ini"

The Removal Service command is: mysqld remove

6. After the 5th step succeeds, initialize the data directory
C:\job\mysql-5.7. -winx64\bin>mysqld  --initialize

This step is important, uninitialized, and may cause the MySQL service to fail to start (pit one)

7. Open System Services Management

You can see the MySQL system service

Start MySQL command at the command line for: net start MySQL

Shutdown mysql command for: net stop MySQL

8. Change the root password

Command line execution: Mysql–uroot

Mysql>show databases;

Mysql>use MySQL;
mysql> Update mysql.user set Authentication_string=password (' 12345 ') where user= ' root ' and Host = ' localhost ';

mysql> alter user ' root ' @ ' localhost ' identified by ' 12345 ';

mysql> FLUSH privileges;

Mysql> QUIT

Pit Two: The new version of the MySQL database in the user table has no password field, But the encrypted user password is stored in the authentication_string Field

9. Remote Login Configuration

Allow the root user to remotely log in anywhere and have any permissions to operate on any library, as follows:

1) Log in to MySQL first using the root user:

Command line execution: Mysql-u root-p

Enter password (password set in step 7th): 12345

2) Authorize the operation:

Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' 12345 ' with GRANT OPTION;

Overload Authorization Table:

Mysql>flush privileges;

Exit Mysql:quit

Installing mysql-5.7.12-winx64

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.