Deploy multiple Mysql databases on the same server

1. Create a new database.Insert image description here
Copy the installed 5.7 version library folder and change the folder to 5.8. This is just to distinguish the files. It has nothing to do with the version. You can customize the name.

2. Create a service:

管理员身份cmd进入C:\Program Files\MySQL\MySQL Server 5.8\bin路径,输入mysqld install Mysql58
创建成功显示Service successfully installed
启动失败,显示“本地计算机上的mysql服务启动后停止,....."

服务创建成功之后,要进行修改注册表,通过regedit 进入注册表,
找到HKEY_LOCAL_MACHINE--->SYSTEM--->CurrentControlSet--->Services 这个目录下,
然后找到刚才创建的Mysql58,将ImagePath 
修改成  "C:\Program Files\MySQL\MySQL Server 5.8\bin\mysqld" --defaults-file=
"C:\Program Files\MySQL\MySQL Server 5.8\my-default.ini" Mysql58 ,

Insert image description here
If the original 5.7 database is in the startup state, you need to modify the default port of the configuration file in the 5.8 folder.
Insert image description here

3. Log in to
MYSQL. After installation, the default password is in the .err file under the installation directory data. Search for password in the file.
cmd login mysql: with port number, the default port is not 3306
mysql -h 127.0.0.1 -u root -p -P 3308
The default port number is 3306,
mysql -u root -p

Change the password after logging in:
set password for root@localhost = password('123456');

Insert image description here

3. Data storage data

数据存储data文件默认会C:\Program Files\MySQL\MySQL Server 5.8路径下(图一),
想修改存储路径可在新建立库实例后会有data显示,可将data文件复制到(图二)

Insert image description here
(Figure 1)

(Figure 2)
Modify the my-dafault configuration file in Figure 1:
Insert image description here

Guess you like

Origin blog.csdn.net/FORLOVEHUAN/article/details/128834714