Mysql free installation version configuration tutorial
Graphic version
- Configure environment variables
- Create a new my.ini file and add the following content
[mysqld]
basedir=C:\\software\Mysql\mysql-5.7.14-winx64
datadir=C:\\software\Mysql\mysql-5.7.14-winx64\data
port=3306
- Run cmd as an administrator and switch to the bin directory
- Execute the following statement to initialize
mysqld --initialize --user=mysql --console
- Install the mysql service and execute the following statement
mysqld --install MySQL
- start the service
net start mysql
- If you already have the mysql service, but you can't use it , execute the following statement -- delete the service, and start from step 5 again
mysqld --remove
- login database
mysql -u root -p
- Add a line after [mysqld] in the my.ini file
skip-grant-tables
- Shut down the mysql service and restart it, that is,
net stop mysql
andnet start mysql
-
Re-login:
mysql -u root -p
No need to enter a password, directlyenter
. -
using mysql database,
use mysql
-
Query the user table of the mysql database,
select * from user
;
- Perform an update operation on the table user:
update user set authentication_string = password("root") where user="root";
- Exit mysql
skip-grant-tables
, remove the one in the my.ini file, and restart the mysql service
Go to the mysql database, when using the sql command, if the following error occurs :
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Add three sentences:
step 1: SET PASSWORD = PASSWORD('your new password');
step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
step 3:flush privileges;
In step1, your new password is written by yourself !
Character version
Here is the text version:
Below is the successful picture!
Mysql common command diagram
If there are any mistakes in the article, please correct me, and we can communicate with each other. Students who are accustomed to reading technical articles on WeChat and want to get more Java resources can follow WeChat public account: Java3y