Download and install mysql 5.7 or later, mysql or later
1. Download
1. mysql Website: https://downloads.mysql.com/archives/community/
2. decompress the downloaded package and decompress the package.
3. Place the folder in your favorite location.
Ii. Configure mysql
1. Under the mysql-5.7.17-winx64 directory, create a new my. ini. Copy the following code and save it. My. ini will replace the following my-default.ini File
Note: content of my. ini file:
[Mysql]
; Set the default Character Set of the mysql client
Default-character-set = utf8
[Mysqld]
; Set port 3306
Port = 3306
; Set the installation directory of mysql
Basedir = F: \ mysql-5.7.10-winx64
Set the directory for storing mysql database data
Datadir = F: \ mysql-5.7.10-winx64 \ data
; Maximum number of connections allowed
Max_connections = 200
The default character set used by the server is the 8-bit latin1 character set.
Character-set-server = utf8
The default storage engine used to create a new table
Default-storage-engine = INNODB
Iii. Install the mysql Service
1. Right-click Start and select search and Enter cmd. a command prompt is displayed, right-click and select Run as administrator. Otherwise, an error code with insufficient identity will appear.
2. Open the cmd window as an administrator and switch the directory to the bin directory of the decompressed file. Enter mysqld install and press enter to run the command. Note that:MysqldNot mysql. The installation is successful. This is because I have already installed it.
3. In this case, we can first initialize the data directory with mysqld -- initialize:
4. Change the password
1. Add the command skip-grant-tables under the [mysqld] entry in the my. ini configuration file, and restart mysql.
2.
(1) enter the mysql database:
Mysql> use mysql; Database changed
(2) set a new password for the root user mysql> update user set authentication_string = password ("new password") whereuser = "root ";
Query OK, 1 rows affected (0.01sec) Rows matched: 1 Changed: 1 Warnings: 0
(3) refresh the database (Be sure to refresh) mysql> flush privileges; QueryOK, 0 rows affected (0.00 sec)
(4) Exit mysql: mysql> quit
Comment out the skip-grant-tables in the configuration file. The next time you enter mysql-uroot-p, you can log on with the new password.