Mysql installation-free version configuration and password change tutorial, mysql installation version
Step 1: Configure environment variables (My decompression path: G: \ mysql \ mysql-5.7.21-winx64)
MYSQL_HOME = the decompressed path
PATH = ;%MYSQL_HOME %\bin;
The PATH variable is added based on the original one. Do not delete other settings.
Step 2 Add the my. ini file in the decompressed directory (if this file already exists, replace the content in it)
The file content is
[Client] port = 3306 default-character-set = utf8 [mysqld] port = 3306 character_set_server = utf8 # extract the directory basedir = G: \ mysql \ mysql-5.7.21-winx64 # extract the data directory under the data Directory datadir = G: \ mysql \ mysql-5.7.21-winx64 \ data SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES [WinMySQLAdmin] G: \ mysql \ mysql-5.7.21-winx64 \ bin \ mysqld.exe
Step 3: Run cmd as an administrator (Baidu), enter the bin folder in the decompression path, and execute the mysqld-install command, create a new data folder (NO content in it) under the decompression path)
Step 4: log on
Open cmd as an administrator and enter mysql-uroot-p. Press enter without a password (the default password is blank)
Step 5: change the password
First usenet stop mysql Stop the mysql service and add a section in the my. ini file.skip-grant-tables
Start the mysql service and modify the authentication_string field value of the root user in the user table in the mysql Data Source (originally the password field, and then changed it to authentication_string)
After the operation is successful, delete the skip-grant-tables in the my. ini file.
If an error occurs:
ERROR 1820 (HY000): You must reset your password using alter user statement before executing this statement.
Because the password has expired, you can set it like this
set password = password('mysql');use mysqlupdate user set password_lifetime = 0 where User='root';flush privileges;
Summary
The above is a simple tutorial on configuring and changing the password of mysql without installation. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!