Two (or more) different versions of mysql are installed on one system, how can I switch login smoothly ~

premise

All in all, your configuration file my.ini is in effect
, you can also consider two mysql port is determined is not the same, you can enter positive

(Make sure that the ports are different, it does not mean that you can change the configuration file, and the actual configuration file is effective, the two mysql ports are indeed different)


When creating the service, the default my.ini configuration file location was specified

mysqld install 服务名 --default-file="xxx\my.ini"

Secondly, use a series of operations such as the initialization command, the generated data file, etc.

mysqld --initialize

In the registry
Insert picture description here


positive

1. The port numbers of the two mysqls should be different , which can be set to 3306, 3307

Change setting,
Insert picture description here
Insert picture description here


Two, enter the environment variables, add environment variables

Right click on this computer (My Computer)-Properties
Insert picture description here

Insert picture description here


Three, start two mysql services

Insert picture description here

也可以在cmd中:
命令:
	net start 服务名

例:
	net start mysql5
	net start mysql8

Four, log in to mysql

命令:
	mysql -u用户名 -P端口号 -p密码

Insert picture description here


Personally feel that this setting is very convenient, no need to operate everywhere, after opening the service, you can log in to different mysql in cmd in any directory

It took two days to delete mysql, delete it, configure the configuration, delete the configuration, and find a lot of tutorials. Finally, I kept trying and finally achieved my expected results. Record it. . . .

Guess you like

Origin blog.csdn.net/weixin_45260385/article/details/114949836