MySQL Download and installation process

Source: Internet
Author: User

1: Download MySQL

Official website: https://dev.mysql.com/downloads/mysql/

Select the corresponding download file. (My computer is 64 bits, so this download is a 64-bit download file)

will not download can search online "" "MySQL official website download, there will be a lot of tutorials, recommend a location:" Https://www.cnblogs.com/pipi-changing/p/5452477.html "

2: Install MySQL

Open the download file to extract to the specified file directory. (I unzip this directory for D:\mysql-5.7.21-winx64)

Open the extracted MySQL file under the root directory to create the My.ini (MySQL config file)

About the My.ini configuration file can be directly Baidu search, the following list only simple configuration

The contents of the My.ini file are as follows:
(It is recommended to copy and paste the following files directly)

Note: The Basedir and datadir paths need to be changed to their own MySQL decompression path, that is, the MySQL file path

    1.  [mysql]
    2.   
    3.  # set MySQL client default character set
    4.   
    5.  default-character-set=utf8
    6.   
    7.  [mysqld]
    8.   
    9.   #设置3306端口
    10.   
    11.  port = 3306
    12.   
    13.  # Set M Ysql installation directory
    14.   
    15.  basedir=d:\mysql-5.7.21-winx64
    16.   
    17.  # Setting the data storage directory for the MySQL database
    18.   
    19.  datadir=d:\mysql-5.7.21-winx64\data
    20.  &NBSP
    21.  # allow maximum number of connections
    22.   
    23.  max_connections=200
    24.    
    25. the character set used by the  # service side defaults to a 8-bit encoded latin1 character set
    26.   
    27.  character-set-server=utf8
    28.   
    29.  # The default storage engine that will be used when creating a new table
    30.   
    31.  default-storage-engine =innodb

Locate the cmd command prompt, right-click Run as Administrator ( must run as Administrator, or the installation process will be error )

Go to MySQL subdirectory bin

Input: mysqld--install (Install) mysqld--initialize (Initialize) net start MySQL (run)

If there is a problem with the mysqld--install (installation) process, check the configuration file Basedir and DataDir path setup problem,

Mysqld--initialize (initialization) process problems, check the D:\mysql-5.7.21-winx64 root directory to generate a data file,

3: Set MySQL login password

Previous versions of MySQL root account default password is not empty, if you log in with a blank password must be an error.

After the MySQL installation, open the Data folder in the MySQL installation directory, there is a. err file, open with Notepad, you can see that there are lines inside

A temporary password is generated for [email protected]: xxxxxxxx

localhost: The following is the default password, copy this password to log in,

You must reset your password after you have successfully logged in, or you will always be prompted for the following line error.

You must reset your password using the ALTER USER statement before executing this statement.

Perform the following command to reset the password so that it can be used normally. (third is recommended for easy connection of sqlyogent tools)

First type: SET PASSWORD = PASSWORD (' NEW PASSWORD ')

Second type: Alter USER user () identified by "123456";

The third type: ALTER USER ' root ' @ ' localhost ' identified with Mysql_native_password by ' new password ';

Another way to set the MySQL password (this method is not everyone can succeed).

Password Setup steps:

    1. Save file at the end of the My.ini file by adding "Skip-grant-tables" (Cancel permission settings)
    2. Restart MySQL Service
    3. CMD Enter Mysql-bin directory, enter Mysql-u root-p, return, this time do not need a password to login
    4. Resets the password. Input use MySQL return
    5. Enter update user set Authentication_string=password ("NewPassword") where user= "root"; (new version of MySQL database password field changed to authentication_string)
    6. Delete my.ini file End "Skip-grant-tables" Save file
    7. Restart the MySQL service to log in to the root account with a new password

——————————————— installation is complete ———————————————

You can use the command to view the default installed database:

show databases;

Use MySQL;

Show tables;

Mysql> Show databases;+--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema | | sys                |+----------- ---------+4 rows in Set (0.01 sec) mysql>

See that the MySQL database is initialized by default, where the user table stores information about MySQL users. We can look at the default MySQL user:

Select user,host,authentication_string from Mysql.user;

Mysql> Select user,host,authentication_string from mysql.user;+------------------+-----------+----------------- --------------------------+| User             | host      | authentication_string                     |+------------------+-----------+------------------------------- ------------+| Mysql.infoschema | localhost | *thisisnotavalidpasswordthatcanbeusedhere | | mysql.session |    localhost | *thisisnotavalidpasswordthatcanbeusedhere | | mysql.sys        | localhost | * Thisisnotavalidpasswordthatcanbeusedhere | | Root             | localhost | *27c237a977f4f44d3f551f1a673be14dfd232961 |+------------------+-----------+---------------- ---------------------------+4 rows in Set (0.00 sec) mysql>

The host of administrator root is localhost, which represents only localhost login access. If you want to allow other IP logins to be opened, you need to add a new host. If you want to allow all IP access, you can directly modify the "%"

To create a user:

CREATE USER ' xxh ' @ '% ' identified with Mysql_native_password by ' [Email protected]# ';

# (need to note: mysql8.0 encryption method Modified)
#检查用户

Select User, host, plugin, authentication_string from user\g;

Authorizing a remote database

#授权所有权限
GRANT all privileges on * * to ' xxh ' @ '% ';
#授权基本的查询修改权限, set on demand
GRANT select,insert,update,delete,create,drop,alter on *. * to ' xxh ' @ '% ';

View User Permissions
Show grants for ' xxh ' @ '% ';

Example:

mysql> use mysql;database changedmysql> CREATE USER ' xxh ' @ '% ' identified with Mysql_native_password by ' [Email prote cted]# '; #创建用户 (Note: mysql8.0 encryption modified) Query OK, 0 rows affected (0.07 sec)
Mysql>

To view password encryption methods:

Mysql> Select User, host, plugin, authentication_string from user;+------------------+-----------+---------------- -------+-------------------------------------------+| user | Host | Plugin | authentication_string |+------------------+-----------+-----------------------+----------------------- --------------------+| Xxh | %         | Mysql_native_password | *70fd6fb4f675e08ff785a754755b5eba6da62851 | | Mysql.infoschema | localhost | Mysql_native_password | *thisisnotavalidpasswordthatcanbeusedhere | | mysql.session | localhost | Mysql_native_password | *thisisnotavalidpasswordthatcanbeusedhere | | Mysql.sys | localhost | Mysql_native_password | *thisisnotavalidpasswordthatcanbeusedhere | | Root | localhost | Mysql_native_password | *27c237a977f4f44d3f551f1a673be14dfd232961 |+------------------+-----------+-----------------------+------------- ------------------------------+5 rows in Set (0.00 sec) MYSQL&GT 

In addition, if you need to add a new account, or other people outside the computer to access MySQL will also need to set up the built-in account host, for reference: MySQL create user and authorization

Reference from: http://www.cnblogs.com/xiongzaiqiren/p/8970203.html

MySQL Download and installation process

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.