In the past few days, I have been crazy about the configuration of various environments. I have inquired a lot of information. It is a bit of experience. ForMysql installation and solutions to possible problems.
I’m talking here zip installation tutorial .
MysqlInstallation address:https:// www.mysql.com/Or direct Baidu searchMysql.
1, the interface after entering the official website is:
2, Scroll down to the lowest to find< strong>Downloads,Select< /span>MySQL Community Server
3. After clicking in, select the first zip to download
4. Select no thanks below… click
5After downloading It is a zip compressed package file: mysql-8.0.18-winx64.zip, and then decompress this file. After decompression, I put the decompressed file in C:\Program Files
< img alt="share picture" src="/wp-content/uploads/images/database/mysql/16268165 21018.png" >
6. Set environment variables
Right click on my computer and select properties
Then select advanced system settings
7,
8. Create a new system variable
9. The variable name is MYSQL_HOME, and the variable value is C:\ Program Files\mysql-8.0.18-winx64 (the path of your own installation package)
10. Add %MYSQL_HOME%\bin to the PATH in the system variables. After adding, you must remember to click “OK” or it won’t save it. Please confirm after going out
p>
p>
11. After the environment is configured, create a new my.ini file under the mysql-8.0.11-winx64 folder (because in the latest version There is no my in the zip. ini file, you need to create a new one yourself) Paste the following into the my.ini file
[mysql]
# Set the default character set of the mysql client
default-character-set=utf8< br>[mysqld]
#Set 3306 port
port = 3306
# Set mysql installation directory
basedir=D:\mysql-8.0.17-winx64
# Set mysql database Data storage directory
datadir=D:\mysql-8.0.17-winx64\data
# The maximum number of connections allowed
max_connections=200
# The character set used by the server defaults to 8-bit encoding The latin1 character set
character-set-server=utf8
# The default storage engine that will be used when creating a new table
default-storage-engine=INNODB
12, basedir here =D:\mysql-8.0.17-winx64, datadir=D:\mysql-8.0.17-winx64\data The path in the two sentences can be changed to the path of your own zip package.
13. Needed here Note that some tutorials may ask you to create a new data folder if there is no data folder in the root directory of mysql-8.0.17-winx64. This is a problem. You will not find it when you install Mysql using the command line. The initial login password, personal experience, toss me for a long time, in fact, when you enter the mysqld --initialize
command to initialize mysql, a new data folder will be created automatically.
14. Open the cmd command window as an administrator and enter: cd C:\Program Files\mysql-8.0.18-winx64\bin into your bin directory, and then enter The mysqld --initialize
command initializes the mysql data data directory. After the initialization is completed, a data folder will be generated in the unzipped directory, and there is a file ending with .err in this folder , There will be a randomly generated password after opening. As shown in the figure below
15. Open with Notepad and find this sentence A temporary password is generated for [email protected]: goeT/zsgK64_, goeT/zsgK64_ is the password at the beginning, remember to log in later with
16, then enter mysqld -install to add services
- Enter net start mysql to start the service
-
Enter mysql -u root -p to log in to the database, and then you will be prompted for a password. Then log in with your password above
- Modify the password statement: ALTER USER [email protected] IDENTIFIED BY ‘123456’; Modify the password as: 123456
- To delete mysql, the executable command mysqld –remove mysql
17. If you have not found the initial password or have forgotten the password
For MySQL versions before 8.0, you can check this Article blog https://blog.csdn.net/lina_999/article/details/87797322
After MySQL version 8.0, it is https://blog.csdn.net/q283614346/article/details/90732968
18. Start MySQL error: ERROR 2003 (HY000): Can’t connect to MySQL server on’localhost’ (10061)
https://blog.csdn.net/ BigData_Mining/article/details/88344513
18. Since many tutorials now have old versions of Mys Ql installation, the setting of environment variables is a bit different, which leads me to follow the original method and it has not worked. Some problems are solved in the old version, which can not be solved at all. The above URLs are all for the latest version.