In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to install two mysql databases on the computer, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
In the actual development, some low-version databases do not support some special sql statements, so there will be problems when the high-version database data is imported into the lower version. Therefore, in some special cases, the low-version database cannot be moved, and the high-version mysql data cannot be imported into the low-version mysql, so we have to install two versions of mysql on the same machine.
Examples of sql statements that are not supported by lower versions of mysql, such as the following:
CREATE TABLE `storage` (`storageid` INT (11) NOT NULL AUTO_INCREMENT, `createTime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, `updateTime` TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`storageid`) ENGINE=INNODB AUTO_INCREMENT=292 DEFAULT CHARSET=utf8 COMMENT=' Warehouse'
Executing the above statement on version 5.1 of mysql will result in an error
In version 5. 7, mysql supports dual-timestamp timestamp. The above sql statement can be executed normally
The text officially begins:
First, stop the previously installed lower version of the mysql service:
Second, copy the mysql5.7 installed on my other computers (I have installed the mysql-5.7.22-winx64.zip version on other computers)
After the third copy, go to the folder, delete the data directory, open my.ini, and modify the port number. The port number will be changed to 3307, and datadir and basedir will also need to be reconfigured.
The modified content is as shown in the figure:
You can take the contents of the configuration file if you want:->
[mysqld] port = 3307basedir=C:\ mysql-5.7.22-winx64datadir=C:\ mysql-5.7.22-winx64\ datamax_connections=200character-set-server=utf8default-storage-engine=INNODBsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_ tables [MySQL] default-character-set=utf8
Begin to perform the steps of installing and adding services:
4.1 run the command line window as an administrator
4.2 enter the bin directory of mysql5.7
4.3 install the mysql service, specify the mysql service name as mysql2, and install it according to the my.ini file, with the following command:
C:\ mysql-5.7.22-winx64\ bin > mysqld install mysql2-- default-file= "C:\ mysql-5.7.22-winx64\ my.ini" prompts: Service successfully installed.
If you go to the service, you can see that there is an additional mysql2 service at this time.
5 initialize the database
After the mysql service is successfully installed, the database needs to be initialized, otherwise the service cannot be started.
Execute the following command in the bin directory
C:\ mysql-5.7.22-winx64\ bin > mysqld-- initialize
After successful initialization, there is no prompt on the command line. However, the data directory has been automatically generated in the mysql5.7 folder
Open the registry, find HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ mysql2, modify the ImagePath parameter, and correct the path related to the mysql2 service.
Modify the ImagePath parameters:
7 start the database and change the password
Start the mysql2 service using the net start mysql2 command
The C:\ mysql-5.7.22-winx64\ bin > net start mysql2mysql2 service is starting. The mysql2 service has started successfully.
(if mysql2 fails to start, please check whether you have stopped the previous mysql service, see step 1)
After the mysql2 service starts, go to the data/xxx.err file to find the temporary password and log in
Log in with a temporary password (note: P port, p password)
C:\ mysql-5.7.22-winx64\ bin > mysql- P3307-uroot-p
Enter password: * (temporary password entered here)
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.7.22
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql >
Modify the password
Mysql > set password for root@localhost=password ('001nX123456'); Query OK, 0 rows affected, 1 warning (0.00 sec)
Log out using quit and log in with the new password.
Mysql > quitByeC:\ mysql-5.7.22-winx64\ bin > mysql- P3307-uroot-pEnter password: * Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 3Server version: 5.7.22 MySQL Community Server (GPL) these are all the contents of the method of installing two mysql databases on your computer. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.