In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Record the installation and configuration method of mysql 8.0.12 and share it with you.
I. installation
1. Download the MySQL8.0.12 version from the Internet, download address
two。 Decompress after the download is complete
The path of my decompression is: d:\ Java\ mysql-8.0.12-winx64
3. Configuration file
First, check whether the file contains my.ini under the decompressed path, and if not, create a new one, as follows:
[mysqld] # set port 3306 port=3306# set mysql installation directory basedir=D:\ Java\ mysql-8.0.12-winx64# set the data storage directory of mysql database datadir=D:\ Java\ mysql-8.0.12-winx64\ 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
4. Database configuration
Enter cmd with administrator privileges (if you do not have administrator privileges, there will be problems), and go to the bin directory of the MySQL installation directory
Then enter mysqld-- initialize-- console, the following screen will appear, in which the red is the initial password of the database root user, be sure to keep in mind, later login needs to be used, of course, if accidentally turned off or not remembered, delete the initialization data directory, and execute the initialization command again will regenerate.
Then type mysqld-- install to install the mysql service, type net start mysql to start the service, note: mysqld-- remove is to uninstall the MySQL service, net stop mysql is to stop the service.
5. Enter the configuration of the database
After entering mysql-u root-p, you will be asked to enter your password, which is the password you were asked to remember. After entering it correctly, the following interface will appear, indicating that you have entered the MySQL command mode.
Then change the password and enter ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' new password; the following interface indicates that the change is successful.
At this point, the MySQL8.0.12 database installation is complete.
II. Database-related configuration
View the default database: show databases
Select mysql database: use mysql
View default MySQL users: select host, user, authentication_string, plugin from user
Create a new user: CREATE USER 'username' @ 'host name' IDENTIFIED WITH mysql_native_password BY 'password'
Authorize new users: GRANT ALL PRIVILEGES ON *. * TO 'username' @ 'host name'
Refresh permission: FLUSH PRIVILEGES
Third, detailed explanation of the problem.
1. MySQL8.0.12 cannot connect to Navicat
Reason: MySQL8.0 and MySQL5.0 do not have the same encryption rules, so Navicat cannot be opened. You can view password rules through select host, user, authentication_string, and plugin from user;.
As shown in the figure above, the plugin column is the corresponding user's encryption rule. You can see that my root user's encryption rule is: mysql_native_password. This is because I have already set it. The default is: caching_sha2_password, so we only need to change the default caching_sha2_password to mysql_native_password.
Solution: enter ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' new password; you can change the encryption rules and passwords of root users.
two。 Authorization error, displaying You are not allowed to create a user with GRANT
Reason: there are many tutorials on the Internet that when The user specified as a definer ('root'@'%') does not exist appears, it means that root users do not have enough privileges and only need to execute GRANT ALL ON *. * TO' root'@'%';, but there is often an error prompt for You are not allowed to create a user with GRANT. This is because the percent sign in the statement @'%'in the sentence GRANT ALL ON *. * TO 'root'@'%'; is actually the name of the host corresponding to the root user. Many people do not notice that his root user actually corresponds to localhost and directly executes the above statement, so the error is reported.
Solution: just change the% in GRANT ALL ON *. * TO 'root'@'%'; to the corresponding host name, and finally refresh the permission FLUSH PRIVILEGES;.
Special note: it is said on the Internet that% means to match all the host, but the operation is not successful. I don't understand why. I guess it may have something to do with the MySQL8.0 version.
Wonderful topic sharing:
Installation tutorials for different versions of mysql
Installation tutorials for each version of mysql5.7
Installation tutorials for each version of mysql5.6
Installation tutorials for each version of mysql8.0
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.