In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what is the installation method of MySQL8.0 For Windows". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
MySQL8.0 For Windows installation tutorial (custom configuration file, password modification)
Download the zip installation package:
Download address of MySQL8.0 For Windows zip package: https://dev.mysql.com/downloa..., you can enter the page without logging in. Then click on the bottom "No thanks, just start my download." You can start downloading.
Or download directly: https://dev.mysql.com/get/Dow...
Environment: Windows 10
One, installation
1.1.Unzip the zip package to the installation directory
For example, my installation directory is: C:\ Program Files\ MySQL
1.2, profile
On Windows systems, the configuration file defaults to the my.ini file (or my-default.ini) in the installation directory. Some of the configuration needs to be configured during the initial installation, and most can be changed after the installation is complete. Of course, in extreme cases, everything can be changed.
We found that there is no my.ini file in the extracted directory, so you can create it yourself. Add my.ini under the installation root directory. For example, here is: C:\ Program Files\ MySQL\ my.ini, and write to the basic configuration:
[mysqld] # set port 3306 port=3306# set mysql installation directory basedir=C:\ Program Files\ MySQL# set the data storage directory of mysql database datadir=E:\ database\ MySQL\ Data# allow the maximum number of connections max_connections=200# allows the number of connections to fail. This is to prevent anyone from attempting to attack the character set used by the max_connect_errors=10# server of the database system from this host. By default, the default storage engine default-storage-engine=INNODB# that UTF8character-set-server=utf8# will use when creating a new table uses the "mysql_native_password" plug-in authentication default_authentication_plugin=mysql_native_ password [MySQL] # to set the mysql client default character set default-character-set=utf8 [client] # setting. Set the port port=3306default-character-set=utf8 used by default when the mysql client connects to the server
Note that basedir is my local installation directory, datadir is the location where my database data files are stored, and each configuration needs to be configured according to my own environment.
To view all configuration items, please refer to: https://dev.mysql.com/doc/ref...
1.3, initialize the database
Execute the command in the bin directory of the MySQL installation directory:
Mysqld-initialize-console
When the execution is complete, the initial default password for the root user is printed, such as:
C:\ Users\ Administrator > cd C:\ Program Files\ MySQL\ binC:\ Program Files\ MySQL\ bin > mysqld-- initialize-- console2018-04-28T15:57:17.087519Z 0 [System] [MY-013169] [Server] C:\ Program Files\ MySQL\ bin\ mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 49842018-04-28T15:57:24.859249Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rI5rvf5x5G E2018-04-28T15:57:27.106660Z 0 [System] [MY-013170] [Server] C:\ Program Files\ MySQL\ bin\ mysqld.exe (mysqld 8.0.11) initializing of server has completedC:\ Program Files\ MySQL\ bin >
Be careful! There is a paragraph in the output of the execution: [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rI5rvf5x5G,E, where the "rI5rvf5x5G,E" after root@localhost: is the initial password (without the first space). You need to remember this password before you change it, and you need to use it for subsequent logins.
If you are cheap, close fast, or don't remember, that's fine. Delete the initialized datadir directory, execute the initialization command again, and it will be regenerated. Of course, you can also use security tools to force you to change your password, and you can do whatever you want.
Reference: https://dev.mysql.com/doc/ref...
1.4, install the service
Execute the command in the bin directory of the MySQL installation directory (open the cmd command line as an administrator, or right-click Shift+ in the installation directory to "open a command line window here"):
Mysqld-- install [service name]
The following service name can be left unwritten, and the default name is mysql. Of course, if you need to install multiple MySQL services on your computer, you can distinguish them with different names, such as mysql5 and mysql8.
After the installation is complete, you can start the MySQL service with the command net start mysql.
Example:
C:\ Program Files\ MySQL\ bin > mysqld-- installService successfully installed.C:\ Program Files\ MySQL\ bin > the net start mysqlMySQL service is starting.. the MySQL service has started successfully. C:\ Program Files\ MySQL\ bin >
Reference: https://dev.mysql.com/doc/ref...
Second, change password and password authentication plug-in
Execute the command in the bin directory of the MySQL installation directory:
Mysql-u root-p
At this time, you will be prompted to enter the password, remember the password of the installation in step 1.3 above, and enter it to log in successfully and enter the MySQL command mode.
Before MySQL8.0.4, execute
SET PASSWORD=PASSWORD ('[modified password]')
You can change the password, but starting with MySQL8.0.4, it doesn't work by default. Because before, the password authentication plug-in for MySQL was "mysql_native_password", but now it is "caching_sha2_password".
Because there are many database tools and link packages that do not support "caching_sha2_password", for convenience, I temporarily changed back to the "mysql_native_password" authentication plug-in.
Change the user's password and execute the command in MySQL:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' New password
Modify the password authentication plug-in and change the password at the same time.
If you want to use "mysql_native_password" plug-in authentication by default, you can configure the default_authentication_plugin entry in the configuration file.
[mysqld]
Default_authentication_plugin=mysql_native_password
Example:
C:\ Program Files\ MySQL\ bin > mysql-u root-pEnter password: * Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 8Server version: 8.0.11Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' new password; Query OK, 0 rows affected (0.06 sec) mysql >
Copy the code
Reference: https://dev.mysql.com/doc/ref...
At this point, the installation and deployment is complete. Officials say the test speed MySQL8 is twice as fast as 5.
You can use the command to view the default installed database:
Show databases;use mysql;show tables;mysql > show databases;+-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sys | +-+ 4 rows in set (0.01 sec) mysql >
See that the mysql database is initialized by default, where MySQL user information is stored in the user table. We can take a look at the default MySQL user:
Select user,host,authentication_string from mysql.user
Mysql > select user,host,authentication_string from mysql.user +-+ | user | host | authentication_string | +- +-+ | mysql.infoschema | localhost | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.session | localhost | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.sys | localhost | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | root | localhost | * 27C237A977F4F44D3F551F1A673BE14DFD232961 | +-+ -+-+ 4 rows in set (0.00 sec) mysql >
Administrator root's host is localhost, which means localhost login access only. If you want to allow other ip logins to be open, you need to add a new host. If you want to allow all ip access, you can directly modify it to "%"
Create a user:
CREATE USER 'xxh'@'%' IDENTIFIED WITH mysql_native_password BY' xxh223'
(note: mysql8.0 encryption has been modified) check users
Select user, host, plugin, authentication_string from user\ G
Authorize remote database
Authorize all permissions
GRANT ALL PRIVILEGES ON *. * TO 'xxh'@'%'
Authorize basic query and modify permissions and set them as needed
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *. * TO 'xxh'@'%'
View user permissions
Show grants for 'xxh'@'%'
Example:
Mysql > use mysql;Database changedmysql > CREATE USER 'xxh'@'%' IDENTIFIED WITH mysql_native_password BY' xxh223 encrypted users; # create users (Note: mysql8.0 encryption has been modified) Query OK, 0 rows affected (0.07 sec) mysql >
View password encryption method:
Mysql > select user, host, plugin, authentication_string from user +-+ | user | host | plugin | | authentication_string | +-+ | xxh | | |% | mysql_native_password | * 70FD6FB4F675E08FF785A754755B5EBA6DA62851 | | mysql.infoschema | localhost | mysql_native_password | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | mysql.session | localhost | mysql_native_password | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql.sys | localhost | mysql_native_password | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | root | localhost | mysql_native_password | * 27C237A977F4F44D3F551F1A673BE14DFD232961 | +-| -+-+ 5 rows in set (0.00 sec) mysql >
In addition, if you need to add a new account, or if someone other than this machine accesses the MySQL, you also need to set the host of the built-in account. For more information, please see MySQL to create users and authorizations.
This is the end of the content of "what is the installation method of MySQL8.0 For Windows". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.