Under MySQL 5.7.26 installation and configuration --windows10 system

 

The installation process is omitted, can download unpack

First, configure the my.ini
in the extracted directory, create a new my.ini

[mysql]
default-character-set=utf8
[mysqld]
port = 3306
basedir=D:\Program Files\mysql-5.7.26-winx64
datadir=D:\Program Files\mysql-5.7.26-winx64\data
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB

 

Second, install mysql service

Open an administrator cmd window, change the directory to unzip the file under your bin directory
execute: mysqld install

  1.  
    D:\Program Files\mysql-5.7.26-winx64\bin>mysqld install
  2.  
    Service successfully installed.

Third, the initialization data directory
execute: mysqld --initialize
will generate data directory

D:\Program Files\mysql-5.7.26-winx64\bin>mysqld --initialize

 

 

Fourth, start the service
execution: net start mysql

Fifth, landing mysql

DESKTOP-PB5DAU8.err log in, find the root user temporary password:

 

Execution: mysql -u root -p mysql login

Sixth, change the root password
after password modification, quit re-visit

  1.  
    mysql> alter user 'root'@'localhost' identified by '123456';
  2.  
    Query OK, 0 rows affected (0.00 sec)
  3.  
     
  4.  
    mysql> exit
  5.  
    Bye

     

Seven, create a database and user
1, create a user
1) log on locally

create user 'user1'@'localhost' identified by '654321';

2) can remotely log

create user 'user2'@'%' identified by '654321';

2. Create a database
1) using the default character set

create database webapp;

2) specified character marks Collection

create database webapp2 default charset utf8 collate utf8_general_ci;

3, authorized user rights
1) authorize user access to a database section

grant select,update,delete,create on webapp.* to 'user1'@'localhost';

2) All rights to the authorized user of a database

grant all privileges on webapp2.* to 'user2'@'%';

4, view the database

show databases;

5, view the user

select user,host,authentication_string from mysql.user;

Guess you like

Origin www.cnblogs.com/joyny/p/10991194.html