In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to install MySQL8 in Windows, in view of this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Windows install MySQL8
1. Extract the zip package to the installation directory
Decompress it in C:\ mysql
two。 Add the bin directory path of MySQL to the PATH environment variable, semicolon + location of the bin file
3. Configure the initialized my.ini file and add my.ini (create a new text file and change the file type to .ini) under the installation root C:\ mysql\:
[mysqld] # set port 3306 port=3306# set basedir to your installation path# set mysql installation directory # remember to use double slash here, single slash I will make mistakes here, but read other people's tutorials, there are plenty of single slashes. Try it yourself # basedir=C:\\ mysqlbasedir=C:/mysql# set datadir to the location of your data directory# set the directory where the data of the mysql database is stored # datadir=C:\\ mysql\\ Datadatadir=C:/mysql/data# 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 new tables uses the "mysql_native_password" plug-in authentication. Password encryption rule default_authentication_plugin=mysql_native_ password [MySQL] # set mysql client default character set default-character-set=utf8 [client] # set mysql client default port port=3306default-character-set=utf8 when connecting to the server
Note: the data directory does not need to be created. It will be created automatically in the next initialization.
4. Initialize the data directory
Run cmd as an administrator (be sure to run as an administrator, otherwise there are not enough privileges)
Enter: cd C:\ mysql\ bin to enter the bin folder of mysql, regardless of whether you have configured the environment variable or not, enter the bin folder, otherwise the startup service will still report error 2
Execute the command: mysqld-- initialize-- console
When the execution is complete, the initial default password of the root user is printed, such as: A temporary password is generated for root@localhost: hrpN:uK-r1ee
The following "hrpN:uK-r1ee" is the initial password (without the first space). The initial password can be recorded in the xxx.err file under the generated data directory.
Or delete the initialized datadir directory and execute the initialization command again to regenerate
If: mysqld: Can't create directory'C:\ mysql\ data\'(OS errno 2-No such file or directory), check the path in the my.ini file
If mysqld cannot determine the correct location of the installation directory or data directory, you may need to specify the-- defaults-file option
C:\ > bin/mysqld-defaults-file=C:\ mysql\ my.ini-initialize
When the-- initialize or-- initialize-insecure option is called, mysqld executes the following initialization sequence
(1) the server checks for the existing data directory and creates it if prompted that there is no data directory. If prompted for a data directory but not empty, delete the data directory or rename the data directory
(2) create mysql system database and its tables in data directory, including authorization table, server-side help table and time zone table.
(3) the server initializes the system tablespace and the related data structure to manage the InnoDB table
(4) the server creates a 'root'@'localhost' superuser account and other reserved accounts
(5) populate the server-side help table instead of the time zone table if fill_help_tables.sql content is available
(6) if you give the-- init-file option to name the file of the SQL statement, the server will execute the statement in the file, which enables you to execute a custom boot sequence
5. Install MySQL as a Windows service
Execute the command in the bin directory:
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.
Run the command services.msc to enter the service manager to see if the service has been registered successfully
Start the service of MySQL
Net start mysql
Out of Service
Net stop mysql or mysqladmin-u root-p shutdown
Note: if the installation of the windows service fails, execute net stop mysql first, use the command sc delete MySQL/mysqld-remove to uninstall the service, and then reinstall
6. Modify the password
C:\ > bin\ mysql-u root-p hrpN:uK-r1ee
Mysql > alter user root@'localhost' identified by '123456 effective immediately
Mysql > use mysql
Mysql > select user,plugin,authentication_string from user
Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' 123456' PASSWORD EXPIRE NEVER
Mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' 123456'
Mysql > FLUSH PRIVILEGES
Mysql > alter user 'root'@'localhost' identified by' 123456'
Remote connection hint using root account: Unable to load authentication plugin 'caching_sha2_password'.
Mysql > ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY' 123456'
7. View MySQL service information
C:\ > mysqladmin version status proc-u root-p
View database information
C:\ > mysqlshow-u root-p
View port occupancy command: netstat-ano
This is the answer to the question about how to install MySQL8 in Windows. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
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.