first step:
My Computer -> Properties -> Advanced -> Environment Variables
Select PATH and add: the path of your mysql bin folder (eg: C:\Program Files\MySQL\MySQL Server 5.6\bin )
PATH=.......;C:\Program Files\MySQL\MySQL Server 5.6\bin
Step 2:
Create a new my.ini file in the installation directory
==========================
[client]
default-character-set=utf8
[mysqld]
port=3306
basedir="E:/myfile/myjava/tools/mysql-5.7.22-winx64"
datadir="E:/myfile/myjava/tools/mysql-5.7.22-winx64/data"
tmpdir="E:/myfile/myjava/tools/mysql-5.7.22-winx64/data"
socket="E:/myfile/myjava/tools/mysql-5.7.22-winx64/mysql.sock"
log-error="E:/myfile/myjava/tools/mysql-5.7.22-winx64/data/mysql_error.log"
#server_id = 2
#skip-locking
max_connections=100
table_open_cache=256
query_cache_size=1M
tmp_table_size=32M
thread_cache_size=8
default-storage-engine=MYISAM
innodb_data_home_dir="E:/myfile/myjava/tools/mysql-5.7.22-winx64/data/"
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=128M
innodb_buffer_pool_size=128M
innodb_log_file_size=10M
innodb_thread_concurrency=16
innodb-autoextend-increment=1000
join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M
max_allowed_packet = 32M
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-grant-tables
============================
third step:
Create a new data folder in the mysql root directory. Make sure that data is an empty folder before installation.
Type mysqld --initialize
Then enter mysqld --install
Success will show Servers Successfully installed
Enter net start mysql in the console to start the mysql service
the fourth step:
Close Mysql. 2. Run mysqld --skip-grant-tables 3. Open another command window and run mysql to change the password
UPDATE user SET authentication_string=PASSWORD("root") where USER="root";
mysql -u root -p