-
Right-click to unzip the package, unzip it to the installation directory, the directory name can be defined by yourself
-
There is no data directory and my.ini in the folder. You need to manually create
my.ini. First create it as my.txt, and edit it in the next step.
-
After the creation is complete, right-click my.txt to open the edit text
basedir is your mysql installation directory
datadir is your database content storage directory, that is, the
sql_model created in the second step is used according to the actual development situation. Generally not required
[mysql]
# Set mysql client default character set
default-character-set=utf8
[mysqld] #Set
3306 port
port = 3306 #Set
mysql installation directory
basedir=D:\utils\mysql\mysql5.7 #Set
mysql database data storage Directory
datadir=D:\utils\mysql\mysql5.7\data #Maximum
number of allowed connections
max_connections=200 #The
character set used by the server defaults to the 8-bit encoding latin1 character set
character-set-server=utf8 #Create
a new table The default storage engine that will be used when
default-storage-engine=INNODB -
Save, and then modify the file suffix to ini.
If your file does not display the suffix name, you can set it in this position.
After you check it, you can display it
-
Configure environment variables
-
Open the cmd command window as an administrator and enter the bin directory under the mysql installation address.
Execute mysqld --initialize
successfully. Various files will be generated under the data folder.
If an error is reported, you need to use the drive letter followed by a double slash.
basedir=D:\utils\mysql\mysql5.7 is modified to basedir=D:\utils\mysql\mysql5.7
datadir=D:\utils\mysql\mysql5.7\data is modified to basedir=D:\utils\mysql \mysql5.7\data -
After executing mysqld --install to generate the windows service
, it will prompt Service successfully installed. -
At this time, we don’t have an administrator (root) password,
so we need to configure skip verification in my.ini. Set the password.
Add skip-grant-tables
at the bottom of the file . 8. Start the service in cmd and net start mysql -
mysql -u root -p Press Enter, and press Enter to enter the password
-
Please use the current version, the following statement to modify the root password, note the single quotes capitalization
update mysql.user set authentication_string = password ( ' 123456') where user = 'root';
refresh permission to
flush privileges; -
In the my.ini file, delete the newly added code skip-grant-tables in the last line;
-
net stop mysql; net start mysql; execute these two commands to restart mysql
If there is a problem with the above modified statement, you can still use it, remember to refresh the permissions flush privileges;
1.alter user'root'@'localhost' identified by '123';
2.set password for ‘root’@‘localhost’=password(‘123’);