[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 543
  • Last Modified:

How to install MySQL on different Port?

Dear Experts,

I'm having a very difficult time trying to install MySQL as a Servicee on a port other than 3306 (Default).

If I can get one to work then I can get 2 to work which is the ultimate goal.

I have trieed to install MySQL on Win2K Pro, and Win2k3 Standard Server both giving me the same exact problem.

First of which I install c:\mysql\bin into the path and triedd the following
c:\mysqld --install mysqld1 defaults-file=c:\my1.cnf

The item mysqld1 is listed in the Services List, but will not start
Gives and error #2.. cannot finnd specified file

same on 2Kpro as on 2k3 server

I then tried a different way.
I typed the entire path and got further
c:\mysql\bin\mysqld --install mysqld1 defaults-file=c:\my1.cnf

This time the service did much better at starting.. got up to 75%, then failed

Does anyone know what the trick is to install MYSQL as a Service on Windows to a different Port?

PS:
My1.Cnf
---------
[mysqld]
basedir=c:\mysql
port=3310
enabled-named-pipe
socket=mypipe2

also tried
[mysqld1]

also tried to include 2 entries in the standard my.ini
[mysqld1]
[mysqld2]

each using different ports: 3308, 3310

Any help would be much appreciated.

Thanks - Glen


0
GlenBoyer
Asked:
GlenBoyer
  • 9
  • 8
1 Solution
 
hernst42Commented:
Have you looke at http://dev.mysql.com/doc/mysql/en/Multiple_Windows_command-line_servers.html

Then create two option files. For example, create one file named `C:\my-opts1.cnf' that looks like this:
[mysqld]
datadir = C:/mydata1
port = 3307

Create a second file named `C:\my-opts2.cnf' that looks like this:
[mysqld]
datadir = C:/mydata2
port = 3308
0
 
GlenBoyerAuthor Commented:
yes.. thats exactly what I was saying..  I have created 2 files.. but before we get that far.. I just want to get 1 to work... therefore justs the 1 file for now called my1.cnf.

As detailed in the first request... see above

- Thanks
0
 
GlenBoyerAuthor Commented:
Does the external file need to be called my-opts1.cnf or can it be called anything.. I called it my1.cnf ??
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hernst42Commented:
can be called my1.cnf but should contain the settings poste there, expacial the data-dir, port is the important setting, not the base-dir or those other settings.
0
 
GlenBoyerAuthor Commented:
I have tried exactly as stated from http://dev.mysql.com/doc/mysql/en/Multiple_Windows_command-line_servers.html

create my-opts1.cnf

[mysqld]
datadir = C:/mydata1
port = 3307

removed any remaining mysql services and reviewed to ensure all are gone

at the c: prompt I typed:
C:\mysql\bin\mysqld --defaults-file=C:\my-opts1.cnf

response:
Failed to install the service (Couldn't Create Service)

any suggestions???

0
 
hernst42Commented:
Did you also done this:

Suppose that you want to run mysqld on port 3307 with a data directory of `C:\mydata1', [...]. (To do this, make sure that before you start the servers, each data directory exists and has its own copy of the mysql database that contains the grant tables.)
0
 
GlenBoyerAuthor Commented:
I'm using the default directory c:\mysql\data

everything is in the default directory
just trying to start on different port

what else should I do?
0
 
hernst42Commented:
If you only want to start that mysql-server on a differnt port use the following a configuration file:

[mysqld]
port = 3307
0
 
GlenBoyerAuthor Commented:
Again... this has not resolved the problem
0
 
hernst42Commented:
I just installed mysql, created a file with that content and started mysqld with the same options and it started mysql on the port i defined in there. Have you modified any other configuration-files in the mysql-directory ??
0
 
GlenBoyerAuthor Commented:
I did install the Control Center and the Administrator which may have corrupted them.

I'm reformatting and trying from scratch without CC/Admin just 4.0.20d MySQL

Then I'll create the 1 file my-opts1.cnf (or can it be called .ini ???

What system have you installed your's on ?
0
 
hernst42Commented:
Its win 2k in german and I installed with mysql 4.1.7.
You can also call the file my-opts1.ini
0
 
GlenBoyerAuthor Commented:
Excellent... what was your install process (past the point of unzipping the zip file)

Such as: -> Run the Setup.exe
-> create my1.ini with port setting
-> at the command prompt type mysql --install defaults-file=c:\my1.ini
-> run Netstat

how did you do it??? (please.. thanks)
0
 
GlenBoyerAuthor Commented:
ok.. brand new install of 2Kpro.. and MySQL 5.0alpha
ran install program
created my1.ini located in the c:\mysql directory
at the command prompt I type:
c:\mysql\bin\mysqld --install mysqld1 defaults-file=c:\mysql\my1.ini

the my1.ini file
[mysqld]
datadir=c:\mysql\data
port=3310
server-id=1

the service is listed in Services as lowercase mysqld1

when I try to start the service within the Services area.. in process to 99% then fails with error 1067
Could not start the mysqld1 service on Local Computer
Error 1067: the process terminated unexpectedly

This is the same message over and over and over... I can't get any farther.
0
 
hernst42Commented:
the command should be
mysqld --install mysqld1 --defaults-file=my1.ini

works here great:
if you get an 1067 error see http://www.experts-exchange.com/Databases/Mysql/Q_21045378.html

You might also try to start the server like this. So you get a better error-log on the screen:
mysqld --defaults-file=my1.ini --console
0
 
GlenBoyerAuthor Commented:
I tried with "--console"... says mysql ERROR: unknown option '--install'

Let me ask this: Does the Service Name need to match the [name] in the ini/cnf file ??
such that if I try
c:\mysql\bin\mysqld --install mysqld5 defaults-file=c:\mysql\my5.ini

does the line in the ini file need to read as follows ????
[mysqld] or [mysqld5]

do they need to match up ????
0
 
hernst42Commented:
no it does not need to match try this command (use C&P):

c:\mysql\bin\mysqld --install mysqld5 --defaults-file=c:\mysql\my5.ini --console
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now