mysql installation problem: The code cannot be executed because MSVCR120.dll cannot be found. Reinstalling the program may solve this problem.
Installation: Microsoft Common Runtime Library Collection 2020-> https://baoku.360.cn/soft/search?kw=%E5%BE%AE%E8%BD%AF%E5%B8%B8%E7%94%A8 %E8%BF%90%E8%A1%8C%E5%BA%93%E5%90%88%E9%9B%86
Preface
There are many problems when installing MySQL. There are many ways to solve the problems on the blog. Here I attach some links. Friends who encounter problems can read and refer to it. This article is mainly for those who are new to the database. To install the MySQL database. At present, the MySQL versions on the official website are 5.5, 5.6, 5.7 and 8. When developing, we generally choose one or two versions lower than the latest version, so I chose 5.7 as the database to be installed.
1. Download steps
- Visit the official website: https://www.mysql.com/
select Community under Downloads - Download the corresponding version
Click on the MySQL Community Server in the figure above to enter the download interface:
find the link of MySQL Community Server 5.7 , click to enter:
choose to download the corresponding ZIP file according to the version of your computer , my computer is 64-bit, so choose To download this item, click Download to enter the following interface:
Click No thanks, just start my download , and then start
downloading. After the download is complete, unzip the file to the disk and directory you want to save. I extracted the file to the E:\Program Files\Mysql directory.
All the work of downloading is completed above.
2. Configure environment variables
- System— >Advanced System Settings—>Environment Variables—>System Variables
click New , the variable name is: MYSQL_HOME , add the location of your mysql-5.7.27-winx64 folder.
Mine is in E:\Program Files\Mysql\mysql-5.7.27-winx64 , as shown in the figure: - Edit Path and copy it
;%MYSQL_HOME%\bin
to the back of the original value, as shown in the figure:
3. Configure the my.ini file
Create a new my.ini file in your mysql-5.7.27-winx64 directory. Mine is in the E:\Program Files\Mysql\mysql-5.7.27-winx64 directory. The content of the my.ini file is:
[mysqld]
#端口号
port = 3306
#mysql-5.7.27-winx64的路径
basedir=E:\Program Files\Mysql\mysql-5.7.27-winx64
#mysql-5.7.27-winx64的路径+\data
datadir=E:\Program Files\Mysql\mysql-5.7.27-winx64\data
#最大连接数
max_connections=200
#编码
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
#编码
default-character-set=utf8
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
After the creation is complete, go to the next step.
4. Install MySQL
1. Enter cmd in the input box and run it as an administrator . Note that it must be run as an administrator , otherwise there will be Install/Remove of the Service Denied due to insufficient management authority during the installation process ! (Installation/uninstallation service rejected) , this is very important!
- Enter the E:\Program Files\Mysql\mysql-5.7.27-winx64\bin directory in cmd : enter the installation command:, if Service successfully installed appears , the installation is successful; if Install of the Service Denied appears , it means Run cmd without administrator privileges: then continue to enter the command:, there will be no prompt at this time: enter the start command: again , and the following prompt appears to prove that MySQL started successfully:
mysqld -install
mysqld --initialize
net start mysql
5. Set MySQL password
1. The main purpose of setting the password here is to solve the problem: ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: NO)
2. First stop the MySQL service and enter the command line net stop mysql
:
3. In Find my.ini in the E:\Program Files\Mysql\mysql-5.7.27-winx64 directory, add any line under the [mysqld] field skip-grant-tables
, and save it:
4. Restart MySQL and enter the startup command:, the net start mysql
following prompt appears MySQL started successfully:
When you enter the command mysql -u root -p
, you do not need to enter a password, just press Enter:
Enter MySQL successfully! Haha, it should be worthwhile to be happy after this step!
5. Enter the command line use mysql
to enter the database:
6. Enter the command line update user set authentication_string=password("xxxxxx") where user="root";
xxxxxx is the new password you set, if the following message appears after hitting enter, the modification is successful!
7. Manually stop the MySQL service, enter the service in the win10 search bar , and find MySQL . Right-click, and then click Stop.
Then delete the skip-grant-tables line in the my.ini file just now , save and close.
8. Start cmd (administrator status) again, enter the start command:, net start mysql
enter mysql -u root -p
again, and enter the password you just set. The following message appears to prove that the setting is successful!
Then enter the command line to use mysql
verify it, and the result is an error:
Since there is no reset password, then reset it.
Type the command line. alter user user() identified by "xxxxxx";
My password is 123456, so I typed alter user user() identified by "123456";
Enter! Getting closer and closer to victory!
Enter the command line again to use mysql
verify it, success!