Mysql-5.7.21 installation Configuration

Source: Internet
Author: User
Tags mysql client mysql version

Engaged in development for many years, in fact, MySQL and the installation of many times, but each need to search the online tutorial, toss half a day to fix, this time simply the whole process of recording down, in order to consult later.

Download

To the MySQL official website, navigate to the DOWNLOADS>>Community>>MySQL Community Server page, or click here directly to Select the appropriate MySQL version of the zip package, and here I am mysql-5.7.21-winx64.zip.

Installation configuration
  1. After downloading the compressed package, unzip it directly to the directory that will be stored;
  2. Create a new file in the root directory my.ini (and no so-called my-default.ini file), save it as an ANSI encoded format, such as:
  3. Copies the following code into My.ini :

    [mysql]< Span class= "CO" ># set MySQL client default character set  Default- character- set  =  utf8[mysqld]# set 3306 ports  port =  3306  # set the installation directory for MySQL  basedir=  D: \\  Program Files\\  mysql-5.7.21  # allow maximum number of connections  Max_ Connections=  200  # the character set used by default is a 8-bit encoded latin1 character set  character- set  - server =  utf8# default storage engine to be used when creating new tables  Default- storage< Span class= "OP" >- engine=  INNODB  
  4. under D:\Program files\mysql-5.7.21\bin directory, press and hold shift+ right-click , select Open Command Window here ;
  5. Execute command mysqld--install , you may receive the following errors:
    • Install/remove of the Service Denied br> This problem occurs because the permissions to execute the command are insufficient, locate the cmd.exe file in the C:\Windows\System32 directory, and re-run as Administrator Open the cmd window, and then go to the D:\Program files\mysql-5.7.21\bin directory and execute the mysqld--install command again.
    • missing Msvcr120.dll,msvcp120.dll
    The problem is obvious, lack of files, what is missing, many online programs, The simplest way is to install the corresponding version of the VC + + Runtime installation package According to the missing files, because MSVCR and MSVCP are all part of VC + + Runtime library, as follows:
    MSVCP, MSVCR, Vcomp140.dll belongs to vc++2015 edition MSVCP, MSVCR, Vcomp120.dll belong to vc++2013 version msvcp, MSVCR, Vcomp110.dll belongs to vc++2012 version msvcp, MSVCR, Vcomp100.dll belongs to vc++2010 version MSVCP , MSVCR, Vcomp90.dll belong to vc++2008 version MSVCP, MSVCR60, 71 and 80.dll, and Vcomp.dll (without the digital version number) belong to the vc++2005 edition
    • Found option without preceding group in config file
      This error generally occurs when the My.ini file header is missing [MySQL] , or another case where the file is encoded in a wrong format, save the file encoding as ANSI .
  6. Executes the command mysqld --initialize , where the folder is automatically generated under the installation root directory data (the original directory does not have the folder).
  7. Execute net start mysql the command to start the service, such as to prove that the installation was successful.

Configure account password

But when we enter mysql a command, the following error occurs.

In fact, we did not set any password, the workaround is as follows:

    1. Open the file in the MySQL directory my.ini , add a line at the end of the file skip-grant-tables , save and close the file.
    2. Restart the MySQL service.
    3. Enter (without entering a password) on the command line and enter the mysql -uroot -p database.
    4. Execute the SQL statement use mysql; using the MySQL database.
    5. Executes the SQL statement update user set authentication_string=password(‘123456‘) where user=‘root‘; .
    6. Open the files in the MySQL directory my.ini , delete the last line skip-grant-tables , save and close the file.
    7. Restart the MySQL service.

      Note:
      At this point, if you perform such use mysql commands, you may see the must reset your password using ALTER USER statement before executing this statement. Error, if present, perform the following steps:

      Execution of orders SET PASSWORD = PASSWORD(‘123456‘); ;
      Executes the command ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER; .

Turn on remote connections
    1. Execution of orders MySQL -uroot -p123456 ;
    2. Execution of orders use mysql; ;
    3. Execution of orders update user set host = ‘%‘ where user = ‘root‘; ;
    4. The Execute command GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION; gives any host permission to access the data.

Mysql-5.7.21 installation Configuration

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.