Mysql Installation-free configuration tutorial

Figure version

  • Configuring environment Variables

  • Create a new my.ini file and add the following
[mysqld] basedir = C: \ \ software/Mysql/Mysql - 5.7.14 - winx64 datadir = C: \ \ software/Mysql/Mysql - 5.7.14 - winx64 \ data port = 3306Copy the code

  • Run CMD as the administrator to switch to the bin directory

  • Execute the following statement to initialize
	mysqld --initialize --user=mysql --console
Copy the code

  • To install the mysql service, execute the following statement
	mysqld --install MySQL
Copy the code

  • Start the service
	net start mysql
Copy the code

  • If you already have the mysql service but can’t use it, execute the following statement to delete the service and start again from step 5
	mysqld --remove  

Copy the code
  • Log in to the database

	mysql -u root -p

Copy the code

  • Ini file on the line after [mysqld]skip-grant-tables

  • Shut down the mysql service and restart it, i.enet stop mysqlnet start mysql

  • Re-login: mysql -u root -p Enter the password without entering it.

  • Using mysql database,use mysql

  • Mysql > select * from user where user = ‘user’;select * from user ;

  • SQL > alter table user;
update user set authentication_string = password("root") where user="root";
Copy the code
  • Exit the mysqlIni fileskip-grant-tablesTake out,Restart the mysql service

Mysql > select * from ‘mysql’;


mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

Copy the code

Add three instructions:

step 1: SET PASSWORD = PASSWORD('your new password');

step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

step 3:flush privileges;

In step1, write your new password yourself!


Word version

This is the text version:

Here’s the picture of success!

Common commands of Mysql


If the article has the wrong place welcome to correct, everybody exchanges with each other. Students who are used to reading technical articles on wechat and want to get more Java resources can follow the wechat public account :Java3y