MySQL installation (Windows version)

Source: Internet
Author: User
Tags uuid password protection

1. Download. Mysql

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

Download Windows Zip package, unzip, add path path bin, System environment variable->path->d:\mysql-5.7.19-winx64\bin modify configuration file: D:\mysql-5.7.19-winx64\ My-default.ini (if you do not have to add them manually) inside the add
[mysqld] Basedir=d:\mysql-5.7.19-winx64
DataDir=d:\mysql-5.7.19-winx64\data #mysql所在目录 \data
2. InstallationOpen the command line with the administrator, locate the MySQL bin directory, put the working directory CD into the directory, and then use the command Mysqld-install
D:\mysql-5.7.19-winx64\bin>mysqld-
Service successfully installed.
After the installation is successful, you can start the service: Enter the operation in the Bin directory: net start MySQL

If the following error occurs:

D:\mysql-5.7.19-winx64\bin>3534 to get more help.
WORKAROUND: MySQL service does not start generally is My-default.ini configuration file is not configured well (some also called My.ini), the most important is to configure Basedir and DataDir.  If you have the remaining questions, go to MySQL my-default.ini configuration in Windows to see the configuration meaning of My-default.ini. Mysqld--initialize initializes the data directory (this statement initializes the parameters again based on the contents of the My-default.ini).
D:\mysql-5.7.19-winx64\bin>mysqld  --initialized:\mysql-5.7.19-winx64\bin>net start The Mysqlmysql service is starting. The MySQL service has started successfully. 
Enter mysqld--initialize-insercure to generate a user without a password (seemingly invalid). After initializing and restarting successfully, look at the Err file under the Data folder and there should be something similar:
2017-09-07t09:37:03.899377z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation forMore details).2017-09-07t09:37:04.569889z 0 [Warning] innodb:new log files created, lsn=457902017-09-07t09:37:04.679042z 0[Warning] innodb:creating FOREIGN KEY constraint system tables.2017-09-07t09:37:04.772602z 0 [Warning] No existing UUID have been found, so we assume that ThisIs the first time that ThisServer has been started. Generating aNewuuid:1bc80410-93b0-11e7-9439-00fff97c2448.2017-09-07t09:37:04.788195z 0 [Warning] Gtid table is not a ready-to-be used. Table ' mysql.gtid_executed 'cannot be opened.2017-09-07t09:37:04.803789z 1 [Note] A temporary password is generated for[Email protected]:Jole/w*_z6rn

3. Verify that the installation is successful

If you see that the MySQL service is starting up. This shows that the direct carriage return is OK, and the boot success is displayed. After the service started successfully, you can log in, Mysql-u root-p enter, prompt for password, enter the above generated random password,

Will show:
D:\mysql-5.7.19-winx64\bin>mysql-u root-************Welcome to the MySQL monitor.   65.7.19, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporationand/ for help. Type ' \c ' to clear the current input statement.

4. Change the password

After installing the MySQL database for the Windows platform, the system has already generated the license table and account by default, and you do not need to execute the mysql_install_db script to generate the account and the appropriate permission permission table as you would on UNIX platforms. However, if you do not install MySQL in MSI format, you will need to manually add a new password to the root account after installation, because the default root does not turn on password protection, if you do not re-give the root account password, many non-native connections will not succeed.

  Method 1: With the Set password command , the specific update password steps are as follows:

C:>mysql-u rootmysql for ' root ' @ ' localhost ' =password (' newpasswd ') MySQL for // This section is optional

With the above settings, root password will be changed to newpasswd This completes the root password setup.

  Method 2: Use Mysqladmin

mysqladmin-u root Password "Newpass"

If Root has already set a password, use the following method:

mysqladmin-u root password Oldpass "Newpass"

  Method 3: Edit the user table directly with update

MySQL-u rootmysql> Use mysql;mysql> UPDATE user SET Password = Password (' newpass ') WHERE user = ' Root '; MySQL> FLUSH privileges;

This can be done when the root password is lost

Mysqld_safe--skip-grant-tables&-u root mysqlmysql> UPDATE user SET password=password ("New Password ") WHERE user= ' root '; MySQL> FLUSH privileges;

  Method 4: Edit the user table by using the Alter user method

ALTER USER ' root ' @ ' localhost ' identified by ' password '

It is so simple to complete the MySQL database default password modification, the default password after modification, you can do more.

4. Exit the database

Three ways to quit MySQL:

MySQL >>> \q;

MySQL installation (Windows version)

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.