Archiv verlassen und diese Seite im Standarddesign anzeigen : Port aendern (MySQL)
Hallo,
ich moechte den Port meines MySQL-Servers auf 443 aendern.
Mir ist auch bekannt das dienste die nicht mit root-Rechten laufen keinen Port unter 1023 bekommen. Das ist auch vermutlich das Problem (siehe log). Kann mir jemand helfen?
060825 10:47:45 mysqld started
060825 10:47:45 InnoDB: Started; log sequence number 0 210328
060825 10:47:45 [ERROR] Can't start server: Bind on TCP/IP port: Permission denied
060825 10:47:45 [ERROR] Do you already have another mysqld server running on port: 443 ?
060825 10:47:45 [ERROR] Aborting
060825 10:47:45 InnoDB: Starting shutdown...
060825 10:47:47 InnoDB: Shutdown completed; log sequence number 0 210328
060825 10:47:47 [Note] /usr/libexec/mysqld: Shutdown complete
060825 10:47:47 mysqld ended
Roger Wilco
25.08.06, 10:12
Das ist auch vermutlich das Problem (siehe log). Kann mir jemand helfen?
Dein Problem ist, dass an Port 443 schon ein anderer Prozess gebunden ist, vermutlich ein Webserver. Ansonsten mysqld als root starten, damit er sich an den Port binden kann.
Auf port 443 laeuft nix mehr. Ich habes mit netstat -tupa getestet.
Als root starten:
su root /etc/init.d/mysqld start
funktioniert auch nicht.
du startest den mysql nicht als root:
# grep user /etc/init.d/mysql
# grep user /etc/init.d/mysql
für diesen Befehl aus
und poste die Ausgabe hier!
Im logfile steht das gleiche drin.
[root@localhost ~]# grep root /etc/init.d/mysqld
[root@localhost ~]# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
[root@localhost ~]# tail -f /var/log/mysqld.log
060825 13:20:39 [ERROR] Can't start server: Bind on TCP/IP port: Permission denied
060825 13:20:39 [ERROR] Do you already have another mysqld server running on port: 443 ?
060825 13:20:39 [ERROR] Aborting
060825 13:20:39 InnoDB: Starting shutdown...
060825 13:20:41 InnoDB: Shutdown completed; log sequence number 0 214727
060825 13:20:41 [Note] /usr/libexec/mysqld: Shutdown complete
060825 13:20:41 mysqld ended
nicht grep root, so wie ich es geschrieben habe...
[root@localhost ~]# grep user /etc/init.d/mysqld
# Rather than assuming we know a valid username, accept an "access
echo "$RESPONSE" | grep -q "Access denied for user" && break
[root@localhost ~]#
hm, dann ist das bei dir wohl anders gelöst:
so sieht es bei mir aus
# grep user /etc/init.d/mysql
mysql_daemon_user=mysql
schau mal im init-script nach, ob der mysqld nicht auf andere Art und Weise als normaler User ausgeführt wird. Oder poste mal deine /etc/init.d/mysql.
#!/bin/bash
#
# mysqld This shell script takes care of starting and stopping
# the MySQL subsystem (mysqld).
#
# chkconfig: - 64 36
# description: MySQL database server.
# processname: mysqld
# config: /etc/my.cnf
# pidfile: /var/run/mysqld/mysqld.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
prog="MySQL"
# extract value of a MySQL option from /etc/my.cnf
# Usage: get_mysql_option FILE VARNAME DEFAULT
# result is returned in $result
# Ugly as this is, it knows nothing of option file sections ...
get_mysql_option(){
result=`sed -n "s/^[ \t]*$2[ \t]*=[ \t]*//p" "$1" 2>/dev/null | tail -n 1`
if [ -z "$result" ]; then
# not found, use default
result="$3"
else
# found, still have to deal with quoting and end-of-line comments
dequoted=`echo "$result" | sed "s/^'\([^']*\)'.*$/\1/"`
if [ x"$dequoted" != x"$result" ]; then
result="$dequoted"
else
dequoted=`echo "$result" | sed 's/^"\([^"]*\)".*$/\1/'`
if [ x"$dequoted" != x"$result" ]; then
result="$dequoted"
else
result=`echo "$result" | sed 's/^\([^ \t#]*\).*$/\1/'`
fi
fi
fi
}
get_mysql_option /etc/my.cnf datadir "/var/lib/mysql"
datadir="$result"
get_mysql_option /etc/my.cnf socket "$datadir/mysql.sock"
socketfile="$result"
get_mysql_option /etc/my.cnf log-error "/var/log/mysqld.log"
errlogfile="$result"
get_mysql_option /etc/my.cnf pid-file "/var/run/mysqld/mysqld.pid"
mypidfile="$result"
start(){
touch "$errlogfile"
chown mysql:mysql "$errlogfile"
chmod 0640 "$errlogfile"
[ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile"
if [ ! -d "$datadir/mysql" ] ; then
action $"Initializing MySQL database: " /usr/bin/mysql_install_db
ret=$?
chown -R mysql:mysql "$datadir"
if [ $ret -ne 0 ] ; then
return $ret
fi
fi
chown -R mysql:mysql "$datadir"
chmod 0755 "$datadir"
# The reason for explicitly specifying --pid-file is that there may
# be no such entry in my.cnf, and the default behavior will be to not
# create it at all. Likewise, we specify --log-error in case there
# was not an entry in my.cnf.
/usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file="$mypidfile" --log-error="$errlogfile" >/dev/null 2>&1 &
ret=$?
# Spin for a maximum of N seconds waiting for the server to come up.
# Rather than assuming we know a valid username, accept an "access
# denied" response as meaning the server is functioning.
if [ $ret -eq 0 ]; then
STARTTIMEOUT=30
while [ $STARTTIMEOUT -gt 0 ]; do
RESPONSE=`/usr/bin/mysqladmin -uUNKNOWN_MYSQL_USER ping 2>&1` && break
echo "$RESPONSE" | grep -q "Access denied for user" && break
sleep 1
let STARTTIMEOUT=${STARTTIMEOUT}-1
done
if [ $STARTTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to start MySQL Daemon."
action $"Starting $prog: " /bin/false
else
action $"Starting $prog: " /bin/true
fi
else
action $"Starting $prog: " /bin/false
fi
[ $ret -eq 0 ] && touch /var/lock/subsys/mysqld
return $ret
}
stop(){
MYSQLPID=`cat "$mypidfile" 2>/dev/null `
if [ -n "$MYSQLPID" ]; then
/bin/kill "$MYSQLPID" >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
STOPTIMEOUT=60
while [ $STOPTIMEOUT -gt 0 ]; do
/bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
sleep 1
let STOPTIMEOUT=${STOPTIMEOUT}-1
done
if [ $STOPTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop MySQL Daemon."
ret=1
action $"Stopping $prog: " /bin/false
else
rm -f /var/lock/subsys/mysqld
rm -f "$socketfile"
action $"Stopping $prog: " /bin/true
fi
else
action $"Stopping $prog: " /bin/false
fi
else
ret=1
action $"Stopping $prog: " /bin/false
fi
return $ret
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/mysqld ] && restart || :
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status mysqld
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|condrestart|restart}"
exit 1
esac
exit $?
"chown mysql:mysql "$errlogfile" "
das deutet ja darauf hin, das der mysql als user mysql ausgeführt wird, was steht denn in der my.cnf?
Roger Wilco
25.08.06, 13:09
--port=port_num, -P port_num
The port number to use when listening for TCP/IP connections. The port number must be 1024 or higher unless the server is started by the root system user.
--user={user_name|user_id}, -u {user_name|user_id}
Run the mysqld server as the user having the name user_name or the numeric user ID user_id. (“User” in this context refers to a system login account, not a MySQL user listed in the grant tables.)
This option is mandatory when starting mysqld as root. The server changes its user ID during its startup sequence, causing it to run as that particular user rather than as root. See Section 5.7.1, “General Security Guidelines”.
To avoid a possible security hole where a user adds a --user=root option to a my.cnf file (thus causing the server to run as root), mysqld uses only the first --user option specified and produces a warning if there are multiple --user options. Options in /etc/my.cnf and $MYSQL_HOME/my.cnf are processed before command-line options, so it is recommended that you put a --user option in /etc/my.cnf and specify a value other than root. The option in /etc/my.cnf is found before any other --user options, which ensures that the server runs as a user other than root, and that a warning results if any other --user option is found.
Dazu unbedingt 5.7. General Security Issues (http://dev.mysql.com/doc/refman/5.0/en/security.html) vollständig lesen und verstehen.
wenn ich in meiner my.cnf
user=root
reinschreibe funktioniert es auch nicht und desweiteren moechte ich den mysqld nicht mit root rechten laufen lassen.
Es gibt doch sicherlich noch andere moeglichkeiten?
Roger Wilco
25.08.06, 20:10
Du könntest MySQL weiterhin auf dem Port 3306 betreiben und Port 443 darauf umbiegen, etwa mit Netfilter/iptables oder tcpredir.
Ansonsten muss mysqld nunmal als root laufen, um sich an Port 443 binden zu dürfen.
an so was habe ich mittlerweile auch gedacht.
Das du damit erfahrung?
Ich habe es jetzt mit iptables gemacht.
Es funktioniert.
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.