Shahid Usman
Shahid Usman

Reputation: 59

creating multiple instance in mysql 5.7 in windows 7

i go through MySQL documentation Running Multiple MySQL Instances on Windows using windows,after that i created two my.cnf files and executed shows below error now

mysqld: Can't change dir to 'C:\Program Files\MySQL\MySQL Server 5.7\data\' (Errcode: 2 - No such file or directory)

my my.cnf file for new instance are

[client]
port=3308
user=root
password=root

[mysqld]
datadir = H:/MySQL Datafiles
port = 3308

please give full steps to create an instance on MySQL along with with default instance which contain port=3306 what am i doing wrong i cant access it using sqlyog it is running perfectely and default port is accesable

Upvotes: 1

Views: 1957

Answers (2)

Krishna
Krishna

Reputation: 1137

I have several MySQL 5.5 instances running on different ports on my Windows 10. I think you need to specify both 'basedir' and 'datadir' path in your my.cnf file. I've done following changes in order to successfully run a new instance on my pc.

  1. For second mysql instance, created a directory ‘Mysql2’ in my C: drive and copied following folders from ‘MySQL5.5’ to ‘Mysql2’ folder.

    • bin
    • data
    • include
    • lib • share

  2. Copied my.ini from ‘MySQL5.5’ to ‘Mysql2’ folder and renamed as 'mysql2.ini’. Opened ‘mysql2.ini’ in Notepad editor and added following lines under [mysql] section. basedir="C:/Mysql2/" datadir="C:/Mysql2/data/"

  3. In windows command-line editor executed following line to start new mysql instance as a service. C:\Mysql2\bin>mysqld --installMysql2 --defaults-file=”C:/Mysql2/mysql2.ini”

  4. Started the new mysql instance with following command.
    net start Mysql2

Upvotes: 1

Mihai Popescu
Mihai Popescu

Reputation: 396

Something like this should help

# options for mysqld1 service
[mysqld1]
basedir = C:/mysql-5.1.55
port = 3307
enable-named-pipe
socket = mypipe1

# options for mysqld2 service
[mysqld2]
basedir = C:/mysql-5.5.54
port = 3308
enable-named-pipe
socket = mypipe2

Install the services as follows, using the full server path names to ensure that Windows registers the correct executable program for each service:

C:\> C:\mysql-5.1.55\bin\mysqld --install mysqld1
C:\> C:\mysql-5.5.54\bin\mysqld --install mysqld2

To start the services, use the services manager, or use NET START with the appropriate service names:

C:\> NET START mysqld1
C:\> NET START mysqld2

To stop the services, use the services manager, or use NET STOP with the appropriate service names:

C:\> NET STOP mysqld1
C:\> NET STOP mysqld2

Upvotes: 0

Related Questions