Installation of mysql5.7.12 under windows

1. Unzip the downloaded mysql installation package to get the following directory structure

    H:\Workspaces\mysql-5.7.12-winx64

 

2. Set environment variables

    MYSQL_HOME=H:\Workspaces\mysql-5.7.12-winx64

    PATH=%MYSQL_HOME%\bin

 

3. Modify \my-default.ini in the mysql root directory

basedir = H:\Workspaces\mysql-5.7.12-winx64

datadir = H:\Workspaces\mysql-5.7.12-winx64\data

port = 3306

2. Enter the MySQL bin folder and install the MySQL service

MySQL install installation service

Order:

bin>mysqld install #Install MySQL service

 

3. Initialize the MySQL data directory.

Initialize the MySQL data directory

Order:

\bin>mysqld --initialize

 

 

4. Start mysql

bin>net start mysql

    

5. Use mysql to log in at this time

bin>mysql -u root

 

会报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Because root has an initialization password.

 

6. Modify the root password of mysql

bin>net stop mysql
bin>mysqld --skip-grant-tables #Start in safe mode

 

At this time, the window does not understand, you need to open another window

cmd...>bin>mysql

 

Log in to mysql at this time

mysql>



 

7. Modify the root password

  In mysql5.7, there is no password field in the user table, it becomes authentication_string

mysql>show databases;
mysql>use mysql;
mysql> update mysql.user set authentication_string=password('root') where user='root' and Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> QUIT

 



 

8. Allow the root user to log in remotely from anywhere and have any operation permissions for all libraries. The specific operations are as follows:

1) Log in to mysql using the root user on this machine:

Command line execution: mysql -u root -p root

2) Perform an authorization operation:

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

Reload the authorization table:

mysql>FLUSH PRIVILEGES;

quit mysql: quit

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326776341&siteId=291194637