Jump to content
The Uniform Server Community
reg

changing mysql default port

Recommended Posts

is it possible to change uniform server's default port

for mysql from 3306 to another port, say 3400, and

if so, what must be done to do so?

 

 

best regards,

Share this post


Link to post
Share on other sites

is it possible to change uniform server's default port

for mysql from 3306 to another port, say 3400, and

if so, what must be done to do so?

best regards,

 

 

 

naturally altering ~\udrive\usr\local\mysql\bin\MY-SMALL.CNF

to change port from 3306 to 3400 and restarting uniform server

doesn't do it.

 

and why do i have to keep killing mysqld-opt.exe through

windows task manager?

Share this post


Link to post
Share on other sites

If you use Norton it generally attempts to block MySQL when you start and stop the servers for the first time. On both occasions make sure you select allow connection on all ports.

 

Like Olajide said you probably are being blocked by a Firewall hence why you have to kill off the mysqld-opt.exe process.

 

Not sure why you would want to change the MySQL port! If you must, first change both ports in my-small config file. You also need to change each MySQL client’s (such as PHP, phpMyAdmin) config file to match the port you are using. I think phpMyBackupPro picks up the default from php.ini (read the manual to make sure).

 

Do you have a genuine problem or is it just an exercise in understanding how it works?

 

All the best

Ric :D

Share this post


Link to post
Share on other sites

localhost:3304 might be a hint. I dont think or better yet, am not too sure if it is needed, since its being hard coded into the my-small.cnf file. hmmm...

Share this post


Link to post
Share on other sites

localhost:3304 might be a hint. I dont think or better yet, am not too sure if it is needed, since its being hard coded into the my-small.cnf file. hmmm...

 

 

 

3304? interesting... i'll look for it next session.

 

log of most recent session:

 

 

 

as per ric @ http://forum.uniformserver.com/index.php?showtopic=1316

 

~\udrive\usr\local\mysql\bin\my-small.cnf (altered fragment below)

 

[client]

# password=my_p

#

# port=3306 altered 10/31/07

port=3400

#socket=MySQL

#

# Here is entri

# The following

# The MySQL ser

[mysqld]

#

#port=3306 altered 10/31/07

port=3400

#

#socket=MySQL

 

 

~\udrive\usr\local\php\php.ini (altered fragment below)

 

; Default port number for mysqli_connect(). If unset, mysqli_connect() will use

; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the

; compile-time value defined MYSQL_PORT (in that order). Win32 will only look

; at MYSQL_PORT.

;

; mysqli.default_port = 3306 altered 11/01/07

;

mysqli.default_port = 3400

;

; Default socket name for local MySQL connects. If empty, uses the built-in

; MySQL defaults.

;

mysqli.default_socket =

 

 

looking for phpmydmin configuration:

 

no *.php, *.inf or *.conf file in or below ~\udrive\... contains $"3306"

other than php.ini and my-small.cnf files as shown above.

 

with above alters:

 

 

 

 

1. started uniform server via 'start.bat'.

 

a. w2k pro task mgr shows mysqld-opt.exe running.

b. apanel: phpinfo() reports without error (fragment):

 

directive local master

mysqli.default_port 3400 3400

 

c. apanel: perl environment reports without error

d. apanel: apache info reports without error

e. apanel: all configuration links function without error

f. apanel: phpadmin - error-> "access denied" error msg:

 

Welcome to phpMyAdmin 2.10.2

Error

 

MySQL said:

#2003 - Can't connect to MySQL server on 'localhost' (10061)

 

g. apanel: error log viewer:

 

- [Thu Nov 01 23:23:20 2007] [notice] Child 804: Starting 250 worker threads.

- [Thu Nov 01 23:23:20 2007] [notice] Child 804: Acquired the start mutex.

- [Thu Nov 01 23:23:20 2007] [notice] Child 804: Child process is running

- [Thu Nov 01 23:23:20 2007] [notice] Parent: Created child process 804

- [Thu Nov 01 23:23:20 2007] [notice] Server built: Jul 27 2006 15:55:03

- [Thu Nov 01 23:23:20 2007] [notice] Apache/2.0.59 (Win32) PHP/5.2.3 configured --

resuming normal operations

 

2. opening shell in ~\usr\local\mysql\bin\

 

a. executing 'mysql -uroot -pmypassword'

b. response from kerio firewall:

 

'MYSQL.EXE' from your computer wants to connect

to [my system name] [127.0.0.1], port 3306

 

c. access granted.

e. mysql responds with error: ERROR 2003 (HY000): Can't connect to MySQL

server on 'localhost' (10061)

 

3. at apanel:

 

a. executing 'stop mysql'

b. response from kerio firewall:

 

'MYSQLADMIN.EXE' from your computer wants to connect

to [my system name] [127.0.0.1], port 3306

 

app: w:\usr\local\mysql\bin\mysqladmin.exe

 

c. manually access via port 3306

d. apanel: issued 'stop mysql', response:

 

» Stop MySQL

Stopping MySQL

 

mysqld-opt.exe is running. MySQL server stopped.

 

e. w2k pro task mgr shows mysqld-opt.exe running

f. apanel: issued 'shutdown server', response:

 

» Server Shutdown

Verify Shutdown

 

Click on Shutdown! and the server will be automatically shut down.

 

Shutdown!

 

g. apanel: issued verify of shutdown'

h. response from kerio firewall:

 

'MYSQLADMIN.EXE' from your computer wants to connect

to [my system name] [127.0.0.1], port 3306

 

app: w:\usr\local\mysql\bin\mysqladmin.exe

 

i. manually permitted access via port 3306.

j. response from kerio firewall: (not an editing error. kerio asked twice)

 

'MYSQLADMIN.EXE' from your computer wants to connect

to [my system name] [127.0.0.1], port 3306

 

app: w:\usr\local\mysql\bin\mysqladmin.exe

 

k. manually permitted access via port 3306.

l. w2k pro task mgr shows mysqld-opt.exe running

m. killed mysqld-opt.exe via w2k pro task mgr.

 

the hunt continues...

 

best,

Share this post


Link to post
Share on other sites

hmm... Why is it still saying 3306 at the end during the shutdown?

 

Oh, and i used 3304 cause i thought you said 3303.. but i see its 3400.

 

Before using phpMyAdmin, did you restart the browser? It might be a cache, stored causing that ones problem. Better yet, restart the PC?

Share this post


Link to post
Share on other sites

hmm... Why is it still saying 3306 at the end during the shutdown?

 

Oh, and i used 3304 cause i thought you said 3303.. but i see its 3400.

 

Before using phpMyAdmin, did you restart the browser? It might be a cache, stored causing that ones problem. Better yet, restart the PC?

 

 

restarted the pc essentially the same response (only one path tested).

 

although i believe the only changes i've made to the default 3.5 setup are those as per the docs relating to security when net access is enabled, and mysql's default port, i will do a fresh install of 3.5 this evening and then test having altered only php.ini and my-small.cnf for the port change.

 

 

best,

Share this post


Link to post
Share on other sites

Ok.

 

 

known clean system. same things.

 

the link library 'php_mysqli.dll' and the executable

'mysqld-opt.exe' contain the string '3306'.

 

is the source code for these programs available

somewhere that you know of?

Share this post


Link to post
Share on other sites

 

 

the link library 'php_mysqli.dll' and the executable

'mysqld-opt.exe' contain the string '3306'.

 

 

should have said that aside from php.ini and my-small.cnf

php_mysql.dll and mysqlid-opt.exe are the *only* files that

contain the string '3306'.

 

i am not a c programmer but i am a very experienced assembly

language programmer in mainframe realtime reentrant and non-

reentrant environments, and i've a fair amount of experience

writing drivers for motorola chips, so source code per-se dosen't

bother me and i may find what's going on in those programs

- and i may find that i can edit the object files directly :D that would

be fun. i've not edited object code in bunches of years.

 

so, is the source code for these programs available somewhere?

 

 

best,

Share this post


Link to post
Share on other sites

Not sure why you would want to change the MySQL port!

OK this is what you can try:

To change the default port 3306 to 3400

 

Steps:

1) Open file my-small located in folder:

*\Uniform Server\udrive\usr\local\mysql\bin

 

Change these lines :

[client]

#password=my_password

#port=3306

port=3400

#socket=MySQL

 

[mysqld]

 

#port=3306

port=3400

 

Moves the MySQL Server to port 3400

 

2) Open file php.ini located in folder:

*\Uniform Server\udrive\usr\local\php

(about line 669) --- I think this is the default (3306) you seeing

; at MYSQL_PORT.

;mysql.default_port =

mysql.default_port = 3400

 

(about line 704)

; at MYSQL_PORT.

;mysqli.default_port = 3306

mysqli.default_port = 3400

 

3) Open file config.inc.php located in folder:

*\Uniform Server\udrive\home\admin\www\phpMyAdmin

(about line 37)

 

$i++;

$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address

#$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port

$cfg['Servers'][$i]['port'] = '3400'; // MySQL port - leave blank for default port

 

4) I think like I said

phpMyBackupPro picks up the default from php.ini

Hence shouldnot be a problem:

 

Note: If you need to do something like this:

define('DB_HOST', 'localhost:3400');

There is a serious problem with one of your set-up.

 

Have fun

All the best

Ric :D

Share this post


Link to post
Share on other sites

 

Not sure why you would want to change the MySQL port!

 

 

Although I've gained from looking, we can call my reason(s) idiosyncratic and be pretty much accurate.

 

 

2) Open file php.ini located in folder: *\Uniform Server\udrive\usr\local\php

(about line 669) --- I think this is the default (3306) you seeing

 

; at MYSQL_PORT.

;mysql.default_port =

 

mysql.default_port = 3400

 

; at MYSQL_PORT. (about line 704)

;mysqli.default_port = 3306

 

mysqli.default_port = 3400

 

3) Open file config.inc.php located in folder:

*\Uniform Server\udrive\home\admin\www\phpMyAdmin (about line 37)

 

$i++;

$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address

#$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port

 

$cfg['Servers'][$i]['port'] = '3400'; // MySQL port - leave blank for default port

 

4) I think like I said phpMyBackupPro picks up the default from php.ini

Hence shouldnot be a problem:

 

 

Yep, I feel guilty not having looked for/at the manual you mentioned earlier. I'll look for it (phpMyAdmin Manual?) on the net.

 

 

Note: If you need to do something like this: define('DB_HOST', 'localhost:3400');

There is a serious problem with one of your set-up.

 

 

I'll watch for it.

 

I am late in responding to your post. Sorry about that. I've been busy.

I'll alter things as you note above this evening and let you know how it goes.

 

Thanks.

 

Best,

 

Alan

Share this post


Link to post
Share on other sites

Things get more interesting.

 

***********

 

from php.ini

 

; Default port number for mysql_connect(). If unset, mysql_connect() will use

; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the

; compile-time value defined MYSQL_PORT (in that order). Win32 will only look

; at MYSQL_PORT.

 

 

"... Win32 will only look at MYSQL_PORT."

 

***********

 

recovered from from mysqld-opt.exe

 

The port the master is listening on.

If not set, the compiled setting of MYSQL_PORT is assumed.

If you have not tinkered with configure options, this should be 3306.

The value in master.info will take precedence if it can be read.

 

***********

 

... compiled setting..., and neither '3306' or its hexadecimal repre-

sentation (0CEA (halfword)) can be found in mysqld-opt.exe.

 

Normally, this would be source code time, and there are indications

(open text within mysqld-opt.exe) that its available, however mysqld-

opt.exe has relatives: mysqld-nt.exe, and mysqld-nt-max.exe. mysqld-

opt.exe may have been chosen for Uniform Server as it will run under

98se.

 

I may end this line of investigation to simply continue developing in

and with Uniform Server. Time passes, but it has been interesting so

far.

 

Have not decided yet.

 

 

Best,

Share this post


Link to post
Share on other sites
Have not decided yet.

 

I have now. It was an interesting and informative diversion

and information gained while (far) afield may be useful, but

its time to return to the mainline of Uniform Server.

 

Best,

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...