Installation under Windows7 uses MySQL8.0. 16 to change password and connect Navicat

  • 2021-12-05 07:41:01
  • OfStack

When installing MySQL, I encountered several problems, and the answers found on the Internet were similar, which did not solve my problems well. After completion, I recorded them for later viewing.

1. Official website downloads version 8.0. 16 MySQL

2. Extract and place the extracted file under C:\ Program Files\ MySQL

3. Configure the environment variable and add C:\ Program Files\ MySQL\ bin to the system variable path

4. Add the configuration file and create my. ini under the MySQL root directory

The contents of the file are as follows. Modify the addresses of 'basedir=' and 'datadir='


[mysqld]
#  Settings 3306 Port 
port=3306
#  Settings mysql Installation directory of 
basedir=C:\Program Files\MySQL
#  Settings mysql The storage directory of the data in the database 
datadir=C:\MySQL\Database
#  Maximum number of connections allowed 
max_connections=200
#  The number of connection failures allowed. This is to prevent an attempt to attack the database system from this host 
max_connect_errors=10
#  The character set used by the server defaults to UTF8
character-set-server=utf8
#  Default storage engine to be used when creating new tables 
default-storage-engine=INNODB
#  Default uses " mysql_native_password "Plug-in authentication 
default_authentication_plugin=mysql_native_password
[mysql]
#  Settings mysql Client default character set 
default-character-set=utf8
[client]
#  Settings mysql The default port used when the client connects to the server 
port=3306
default-character-set=utf8

5. Create Data folder under Program Files\ MySQL

Step 6 View the initial password


mysqld --initialize --console 
 (Password is a string  [Server] A temporary password is generated for root@localhost: q/4<l#jZ3***

If you can't remember, you can copy it to 1 text

7. Enter MySQL


mysql -u root -p  'Enter the password (from above 1 Copy and paste in the document of the step) '

8. Change your password

When connecting with Navicat, the default password is used to report an error. As long as the connection is successful in cmd, you only need to reset the password to connect with Navicat


alter user root@localhost identified by ' New password '

9. Use Navicat or another connection MySQL with a new password

Summarize


Related articles: