MySQL stopped shortly after being started?

C&T: Video Games, Table Top Games & Computerized Stuff
Post Reply
Kreshna Aryaguna Nurzaman
Sick, Twisted Fuck
Posts: 1949
Joined: Thu Jun 09, 2005 2:37 pm
19
Location: MENTAL HOSPITAL
Contact:

#1 MySQL stopped shortly after being started?

Post by Kreshna Aryaguna Nurzaman »

I have to admit, I'm pretty much a MySQL newbie. :oops:

I just installed MySQL 5.0.27-0 on Red Hat Enterprise Linux 4ES. My kernel is 2.6.9-5.0.5.EL. I have successfully installed the following RPMs with the -ivh options:
(1) perl-DBI-1.40-5.i386.rpm (pre-requisite, actually)
(2) MySQL-server-standard-5.0.27-0.rhel4.i386.rpm
(3) MySQL-client-standard-5.0.27-0.rhel4.i386.rpm

All installations have been successful. The executable files (such as mysqld_safe and mysqladmin) are located in the /usr/bin directory.

Like I said, I'm a goddamn newbie in this product, so I merely followed the steps descibed in the refman-5.0-en.a4.pdf file. :(

The documentation said that when doing rpm installation (as opposed to src installation), the mysql_install_db is automatically executed upon the installation. So I figure out the next step is starting the sql daemon, as follows:

Code: Select all

[root@iceheart-rhel4es bin]# ./mysqld_safe &
[1] 3933
[root@iceheart-rhel4es bin]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/iceheart-rhel4es.pid
061215 18:10:25  mysqld ended


[1]+  Done                    ./mysqld_safe
Whoa, what's that supposed to mean? Why the service was being stopped just shortly after it was started?

Naturally, when I tried executing mysqladmin, it failed:

Code: Select all

[root@iceheart-rhel4es bin]# ./mysqladmin version
./mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
Probably the RPM installation did not execute the mysql_install_db command? Just to make sure, I deleted the group mysql, the user mysql, re-created them again, and re-executed mysql_install_db:

Code: Select all

[root@iceheart-rhel4es bin]# mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iceheart-rhel4es password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd / ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
I guess the installation was successful. However, when I tried to execute the mysqld_safe, it just failed again:

Code: Select all

[root@iceheart-rhel4es bin]# ./mysqld_safe --user=mysql &
[1] 3963
[root@iceheart-rhel4es bin]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/iceheart-rhel4es.pid
061215 18:16:59  mysqld ended


[1]+  Done                    ./mysqld_safe --user=mysql
What's going on, actually? :thewall: Image :sheepfucker:
Last edited by Kreshna Aryaguna Nurzaman on Wed Dec 13, 2006 4:41 am, edited 1 time in total.
The Sick, Twisted Fuck | Sap #2 of the Bitter Trio | Knight of the e-mail | Evil Liberal Conspirator | Esoteric Order of Dagon | Weird TGODer

Share your free D&D character here.

:welcome :arrow: :sheepfucker: :thumbsup

So be it. If saying "NO" means being alone, then to hell with love, with romance, with marriage, and all the shit life keeps pumping at me. I'll walk alone, but with freedom and a healed pride.

NEVER buy a LiteOn CD/DVD Writer. Ever.
Kreshna Aryaguna Nurzaman
Sick, Twisted Fuck
Posts: 1949
Joined: Thu Jun 09, 2005 2:37 pm
19
Location: MENTAL HOSPITAL
Contact:

#2

Post by Kreshna Aryaguna Nurzaman »

Hold on, I found something:

Code: Select all

[root@iceheart-rhel4es log]# cat /var/lib/mysql/iceheart-rhel4es.err
061215 17:46:03  mysqld started
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
061215 17:46:03  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
061215 17:46:04  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
061215 17:46:04  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
061215 17:46:05  InnoDB: Started; log sequence number 0 0
061215 17:46:05 [ERROR] Can't start server: Bind on TCP/IP port: Address already           in use
061215 17:46:05 [ERROR] Do you already have another mysqld server running on por          t: 3306 ?
061215 17:46:05 [ERROR] Aborting

061215 17:46:05  InnoDB: Starting shutdown...
061215 17:46:07  InnoDB: Shutdown completed; log sequence number 0 43655
061215 17:46:07 [Note] /usr/sbin/mysqld: Shutdown complete

061215 17:46:07  mysqld ended

061215 17:47:03  mysqld started
061215 17:47:03  InnoDB: Started; log sequence number 0 43655
061215 17:47:03 [ERROR] Can't start server: Bind on TCP/IP port: Address already           in use
061215 17:47:03 [ERROR] Do you already have another mysqld server running on por          t: 3306 ?
061215 17:47:03 [ERROR] Aborting

061215 17:47:03  InnoDB: Starting shutdown...
061215 17:47:05  InnoDB: Shutdown completed; log sequence number 0 43655
061215 17:47:05 [Note] /usr/sbin/mysqld: Shutdown complete

061215 17:47:05  mysqld ended

061215 17:51:55  mysqld started
061215 17:51:55  InnoDB: Started; log sequence number 0 43655
061215 17:51:55 [ERROR] Can't start server: Bind on TCP/IP port: Address already           in use
061215 17:51:55 [ERROR] Do you already have another mysqld server running on por          t: 3306 ?
061215 17:51:55 [ERROR] Aborting

061215 17:51:55  InnoDB: Starting shutdown...
061215 17:51:57  InnoDB: Shutdown completed; log sequence number 0 43655
061215 17:51:57 [Note] /usr/sbin/mysqld: Shutdown complete

061215 17:51:57  mysqld ended

061215 18:10:23  mysqld started
061215 18:10:23  InnoDB: Started; log sequence number 0 43655
061215 18:10:23 [ERROR] Can't start server: Bind on TCP/IP port: Address already           in use
061215 18:10:23 [ERROR] Do you already have another mysqld server running on por          t: 3306 ?
061215 18:10:23 [ERROR] Aborting

061215 18:10:23  InnoDB: Starting shutdown...
061215 18:10:25  InnoDB: Shutdown completed; log sequence number 0 43655
061215 18:10:25 [Note] /usr/sbin/mysqld: Shutdown complete

061215 18:10:25  mysqld ended

061215 18:16:57  mysqld started
061215 18:16:57  InnoDB: Started; log sequence number 0 43655
061215 18:16:57 [ERROR] Can't start server: Bind on TCP/IP port: Address already           in use
061215 18:16:57 [ERROR] Do you already have another mysqld server running on por          t: 3306 ?
061215 18:16:57 [ERROR] Aborting

061215 18:16:57  InnoDB: Starting shutdown...
061215 18:16:59  InnoDB: Shutdown completed; log sequence number 0 43655
061215 18:16:59 [Note] /usr/sbin/mysqld: Shutdown complete

061215 18:16:59  mysqld ended

I'm particularly interested in the following line:

Code: Select all

061215 18:10:23 [ERROR] Can't start server: Bind on TCP/IP port: Address already  in use 
I, uh, also have Oracle on the Linux server, and it uses port numbers from 1024 to 65000, as evident from the content of the sysctl file:

Code: Select all

net.ipv4.ip_local_port_range = 1024 65000
I assume that's the cause? :oops:
The Sick, Twisted Fuck | Sap #2 of the Bitter Trio | Knight of the e-mail | Evil Liberal Conspirator | Esoteric Order of Dagon | Weird TGODer

Share your free D&D character here.

:welcome :arrow: :sheepfucker: :thumbsup

So be it. If saying "NO" means being alone, then to hell with love, with romance, with marriage, and all the shit life keeps pumping at me. I'll walk alone, but with freedom and a healed pride.

NEVER buy a LiteOn CD/DVD Writer. Ever.
User avatar
Destructionator XV
Lead Programmer
Posts: 2352
Joined: Sun Jun 12, 2005 10:12 am
19
Location: Watertown, New York
Contact:

#3

Post by Destructionator XV »

Do a

nmap -A -p 3306 localhost

If you have the nmap security scanner installed, that should tell you if the address is in use and what program and version is using it.

Failing that, try

netstat -a -t | grep 3306

and it will at least confirm that the port is in use. If it is, do a

ps aux | grep mysql

and you can see if mysql is already running.
Adam D. Ruppe
Image Oh my hero, so far away now.....
Kreshna Aryaguna Nurzaman
Sick, Twisted Fuck
Posts: 1949
Joined: Thu Jun 09, 2005 2:37 pm
19
Location: MENTAL HOSPITAL
Contact:

#4

Post by Kreshna Aryaguna Nurzaman »

Destructionator XV wrote:ps aux | grep mysql

and you can see if mysql is already running.

Code: Select all

[root@iceheart-rhel4es log]# ps aux | grep  mysql
root      3733  0.0  0.1  5284 1076 ?        S    Dec15   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/iceheart-rhel4es.pid
100       3754  0.0  1.3 106564 13824 ?      Sl   Dec15   0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/iceheart-rhel4es.pid --skip-external-locking
root      7261  0.0  0.0  5188  652 pts/1    R+   16:37   0:00 grep mysql
and

Code: Select all

[root@iceheart-rhel4es log]# ps -A | grep  mysqld
 3733 ?        00:00:00 mysqld_safe
 3754 ?        00:00:00 mysqld
:oops: It seems another instance of MySQL is already running. Duh! Thanks, by the way.

I'm using RHEL 4 ES; of course it already comes with a built-in MySQL service. No wonder. Damn me for overlooking the obvious. :thewall:

By the way, I have stopped the built-in MySQL service through the Service Manager, and still failed to run the MySQL I installed:

Code: Select all

[root@iceheart-rhel4es bin]# mysqld_safe --user=mysql &
[1] 7487
[root@iceheart-rhel4es bin]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/iceheart-rhel4es.pid
061216 16:52:29  mysqld ended


[1]+  Done                    mysqld_safe --user=mysql
[root@iceheart-rhel4es bin]# mysqld_safe &

Code: Select all

[1] 7519
[root@iceheart-rhel4es bin]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/iceheart-rhel4es.pid
061216 16:52:49  mysqld ended


[1]+  Done                    mysqld_safe

I have even removed the built-in MySQL through Services Manager (clearing the checkbox), and still exactly got the error like I described above.

It seems that I need to re-install the whole Linux, and not including the built-in MySQL during installation.

By the way, I wonder though: how to define the MySQL program folder during the installation? I don't know why or how, but during my latest attempt of installing MySQL, it seems that everything is being put in /usr/bin.
The Sick, Twisted Fuck | Sap #2 of the Bitter Trio | Knight of the e-mail | Evil Liberal Conspirator | Esoteric Order of Dagon | Weird TGODer

Share your free D&D character here.

:welcome :arrow: :sheepfucker: :thumbsup

So be it. If saying "NO" means being alone, then to hell with love, with romance, with marriage, and all the shit life keeps pumping at me. I'll walk alone, but with freedom and a healed pride.

NEVER buy a LiteOn CD/DVD Writer. Ever.
Kreshna Aryaguna Nurzaman
Sick, Twisted Fuck
Posts: 1949
Joined: Thu Jun 09, 2005 2:37 pm
19
Location: MENTAL HOSPITAL
Contact:

#5

Post by Kreshna Aryaguna Nurzaman »

Update: I have restarted the linux server after removing the built-in MySQL, and now my self-installed MySQL runs successfully. Thanks!

However, I'm curious about something. See, when I changed the password with the following command, it was successful:

Code: Select all

[root@iceheart-rhel4es ~]# /usr/bin/mysqladmin -u root password stompballs
But when I changed the password while including the "-h" switch, it failed:

Code: Select all

[root@iceheart-rhel4es ~]# /usr/bin/mysqladmin -u root -h iceheart-rhel4es password broken
/usr/bin/mysqladmin: connect to server at 'iceheart-rhel4es' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
I just wonder: why?



Update: Now I cannot do anything since the last mysqladmin commands

Code: Select all

[root@iceheart-rhel4es ~]# /usr/bin/mysqladmin version
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[root@iceheart-rhel4es ~]
[root@iceheart-rhel4es ~]
[root@iceheart-rhel4es ~]# /usr/bin/mysqladmin variables
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
But there's something interesting:

Code: Select all

[root@iceheart-rhel4es ~]# mysql -h iceheart-rhel4es -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@iceheart-rhel4es ~]
[root@iceheart-rhel4es ~]
[root@iceheart-rhel4es ~]# mysql -h iceheart-rhel4es -u mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9 to server version: 5.0.27-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
See, I cannot run mysql CLI using root account, but when using mysql account, I can.

It seemed I have accidentaly fucked the MySQL root account, am I correct? What actually happened?
Last edited by Kreshna Aryaguna Nurzaman on Thu Dec 14, 2006 5:37 am, edited 1 time in total.
The Sick, Twisted Fuck | Sap #2 of the Bitter Trio | Knight of the e-mail | Evil Liberal Conspirator | Esoteric Order of Dagon | Weird TGODer

Share your free D&D character here.

:welcome :arrow: :sheepfucker: :thumbsup

So be it. If saying "NO" means being alone, then to hell with love, with romance, with marriage, and all the shit life keeps pumping at me. I'll walk alone, but with freedom and a healed pride.

NEVER buy a LiteOn CD/DVD Writer. Ever.
User avatar
Destructionator XV
Lead Programmer
Posts: 2352
Joined: Sun Jun 12, 2005 10:12 am
19
Location: Watertown, New York
Contact:

#6

Post by Destructionator XV »

Once a password is set, you need to tell it that each time. Every time you call mysql or mysqladmin stick a -p at the end of the command line so it prompts you for the password.
Adam D. Ruppe
Image Oh my hero, so far away now.....
Kreshna Aryaguna Nurzaman
Sick, Twisted Fuck
Posts: 1949
Joined: Thu Jun 09, 2005 2:37 pm
19
Location: MENTAL HOSPITAL
Contact:

#7

Post by Kreshna Aryaguna Nurzaman »

Destructionator XV wrote:Once a password is set, you need to tell it that each time. Every time you call mysql or mysqladmin stick a -p at the end of the command line so it prompts you for the password.
I have tried it and it works. Thanks, Adam!

Damn, such thing is never mentioned in the PDF refman file. It gives the impression that I can just execute /usr/bin/mysqladmin without asking to be prompted for password.
The Sick, Twisted Fuck | Sap #2 of the Bitter Trio | Knight of the e-mail | Evil Liberal Conspirator | Esoteric Order of Dagon | Weird TGODer

Share your free D&D character here.

:welcome :arrow: :sheepfucker: :thumbsup

So be it. If saying "NO" means being alone, then to hell with love, with romance, with marriage, and all the shit life keeps pumping at me. I'll walk alone, but with freedom and a healed pride.

NEVER buy a LiteOn CD/DVD Writer. Ever.
Post Reply