User avatar
batence
Posts: 12
Joined: Wed Aug 12, 2015 9:55 am

mysql database failed ... [SOLVED]

Sat Aug 29, 2015 12:31 pm

Hello guys,

jut because I want to use my RPi as hosting only for my blog I have remove X from it to free a space.

I have read some comments in the internet and what I do ....

### removing X
apt-get --purge remove x11-* && apt-get --purge autoremove && reboot

# after that
apt-get update && apt-get -y upgrade


### installing web server software
apt-get install nginx php5-fpm php-apc

### installing database software
apt-get install mysql-client mysql-server php5-mysql phpmyadmin

--> and after that my mysql fails ...

Code: Select all

Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up mysql-server-5.5 (5.5.44-0+deb7u1) ...
[ ok ] Stopping MySQL database server: mysqld.
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
### so I am searching for error logs of mysql

Code: Select all

root@soleil:~# ls /var/log/mysql
root@soleil:~#
Nothing.

### Looking in /var/log

Code: Select all

root@soleil:~# ls /var/log/
alternatives.log  auth.log       btmp        dbconfig-common  dmesg    dmesg.1.gz  dmesg.3.gz  faillog  kern.log  lpr.log   mail.info  mail.warn  mysql    mysql.log  nginx     php5-fpm.log        samba   user.log
apt               bootstrap.log  daemon.log  debug            dmesg.0  dmesg.2.gz  dpkg.log    fsck     lastlog   mail.err  mail.log   messages   mysql.err  news       ntpstats  regen_ssh_keys.log  syslog  wtmp
### Yes there, some log files

Code: Select all

root@soleil:~# cat /var/log/mysql
mysql/     mysql.err  mysql.log
root@soleil:~# cat /var/log/mysql.err
root@soleil:~# cat /var/log/mysql.log
They're empty.

So I believe there I have remove some liberties which mysql depending on them with

Code: Select all

apt-get --purge remove x11-*
But I don't know which are they, also when I tried to install MySQL there's no additional dependencies installing.

Any advise?

Thanks!
Last edited by batence on Sat Aug 29, 2015 3:12 pm, edited 1 time in total.

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: mysql database failed ...

Sat Aug 29, 2015 12:36 pm

X11 and MySQL are entirely unrelated.

To discover why your database is not starting run mysqld from the command line.
sudo mysqld --verbose
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
batence
Posts: 12
Joined: Wed Aug 12, 2015 9:55 am

Re: mysql database failed ...

Sat Aug 29, 2015 12:52 pm

Hello DougieLawson,

Thank you for your fast reply!

Yes I know there's nothing related between MySQL and X but there's a strange issue that comes after removing X.

So I have checked MySQL as you suggest me ...

Code: Select all

root@soleil:~#  mysqld --verbose
150829 12:44:25 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150829 12:44:25 [Note] mysqld (mysqld 5.5.44-0+deb7u1) starting as process 8491 ...
150829 12:44:25 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
150829 12:44:25 [Note] Plugin 'FEDERATED' is disabled.
150829 12:44:25 InnoDB: The InnoDB memory heap is disabled
150829 12:44:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150829 12:44:25 InnoDB: Compressed tables use zlib 1.2.7
150829 12:44:25 InnoDB: Using Linux native AIO
150829 12:44:25 InnoDB: Initializing buffer pool, size = 128.0M
150829 12:44:25 InnoDB: Completed initialization of buffer pool
150829 12:44:25 InnoDB: highest supported file format is Barracuda.
150829 12:44:27  InnoDB: Waiting for the background threads to start
150829 12:44:28 InnoDB: 5.5.44 started; log sequence number 1595675
150829 12:44:28 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
150829 12:44:28 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
150829 12:44:28 [Note] Server socket created on IP: '127.0.0.1'.
150829 12:44:28 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
150829 12:44:28 [ERROR] Do you already have another mysqld server running on port: 3306 ?
150829 12:44:28 [ERROR] Aborting

150829 12:44:28  InnoDB: Starting shutdown...
150829 12:44:29  InnoDB: Shutdown completed; log sequence number 1595675
150829 12:44:29 [Note] mysqld: Shutdown complete
It seems MySQL can't bind port 3306, that is good news because confirm that the liberties of X are unrelated with MySQL.

So it is a port issue.

I have checked ports ...

Code: Select all

root@soleil:~# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2153/sshd
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           2065/avahi-daemon:
udp        0      0 0.0.0.0:32778           0.0.0.0:*                           2065/avahi-daemon:
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1878/dhcpcd
udp        0      0 192.168.1.131:123       0.0.0.0:*                           2106/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           2106/ntpd
root@soleil:~# netstat -lptu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:ssh                   *:*                     LISTEN      2153/sshd
udp        0      0 *:mdns                  *:*                                 2065/avahi-daemon:
udp        0      0 *:32778                 *:*                                 2065/avahi-daemon:
udp        0      0 *:bootpc                *:*                                 1878/dhcpcd
udp        0      0 soleil.local:ntp        *:*                                 2106/ntpd
udp        0      0 *:ntp                   *:*                                 2106/ntpd
root@soleil:~# netstat --listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
udp        0      0 *:mdns                  *:*
udp        0      0 *:32778                 *:*
udp        0      0 *:bootpc                *:*
udp        0      0 soleil.local:ntp        *:*
udp        0      0 *:ntp                   *:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     SEQPACKET  LISTENING     4136     /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     7215     /var/run/avahi-daemon/socket
unix  2      [ ACC ]     STREAM     LISTENING     17305    /var/run/php5-fpm.sock
unix  2      [ ACC ]     STREAM     LISTENING     6125     /var/run/dhcpcd.sock
unix  2      [ ACC ]     STREAM     LISTENING     6127     /var/run/dhcpcd.unpriv.sock
unix  2      [ ACC ]     STREAM     LISTENING     7160     /var/run/dbus/system_bus_socket
And strange again ... I am confused.

Thanks!

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: mysql database failed ...

Sat Aug 29, 2015 2:24 pm

What do you get from
ifconfig -a
sudo netstat -tlnp | grep 3306
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
batence
Posts: 12
Joined: Wed Aug 12, 2015 9:55 am

Re: mysql database failed ...

Sat Aug 29, 2015 2:36 pm

Code: Select all

root@soleil:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr b8:27:eb:da:c4:e7
          inet addr:192.168.1.131  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
          RX packets:25375 errors:0 dropped:1 overruns:0 frame:0
          TX packets:12166 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:26427247 (25.2 MiB)  TX bytes:1522201 (1.4 MiB)

lo        Link encap:Local Loopback
          LOOPBACK  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Code: Select all

root@soleil:~# sudo netstat -tlnp | grep 3306
root@soleil:~#
### Update 2: I have also commented mysql service in /etc/services
root@soleil:~# nano /etc/services
#mysql 3306/tcp
#mysql 3306/udp
Rebooted and still can't bind the port :/

### Update 3: Changing value 127.0.0.1 to my local IP of eth0 (192.168.1.131) in configuration file of MySQL in /etc/my.conf solved my issue!

Code: Select all

root@soleil:~# nano /etc/mysql/my.cnf
And change 127.0.0.1 to your local or real ip.\

note: I have tried with "localhost" but don't work. localhost may can use only when you have bind your local ip to localhost in /etc/hosts.conf but this doesn't make any sense.

Code: Select all

root@soleil:~# service mysql restart
[ ok] Stopping MySQL database server: mysqld.
[ ok ] Starting MySQL database server: mysqld . . . ..
[info] Checking for tables which need an upgrade, are corrupt or were not closed cleanly..
root@soleil:~#
I found the solution here: http://stackoverflow.com/questions/1873 ... onnections

User avatar
rpdom
Posts: 17170
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: mysql database failed ... [SOLVED]

Sat Aug 29, 2015 3:19 pm

Your localhost "lo" interface isn't working. It isn't showing an IP address. Have you got "auto lo" in /etc/network/interfaces?

User avatar
batence
Posts: 12
Joined: Wed Aug 12, 2015 9:55 am

Re: mysql database failed ... [SOLVED]

Sat Aug 29, 2015 3:24 pm

root@soleil:~# cat /etc/network/interfaces
cat: /etc/network/interfaces: No such file or directory
I get nothing but commented line with bind_address helps too too much.

As I have already remember there in other linux and unix distributions that I have stuffing before in my.cnf there no forced option for "bind-address" variable.

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: mysql database failed ...

Sat Aug 29, 2015 5:16 pm

batence wrote: ### Update 3: Changing value 127.0.0.1 to my local IP of eth0 (192.168.1.131) in configuration file of MySQL in /etc/my.conf solved my issue!
Wrong answer. That will fail if your DHCP lease expires and your RPi gets a new IP address.

You need to fix your loopback interface, because other things will fail (unexpectedly) without it.

Or update /etc/mysql/my.cnf with

Code: Select all

bind-address            = 0.0.0.0
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
batence
Posts: 12
Joined: Wed Aug 12, 2015 9:55 am

Re: mysql database failed ...

Sat Aug 29, 2015 6:47 pm

DougieLawson wrote:
batence wrote: ### Update 3: Changing value 127.0.0.1 to my local IP of eth0 (192.168.1.131) in configuration file of MySQL in /etc/my.conf solved my issue!
Wrong answer. That will fail if your DHCP lease expires and your RPi gets a new IP address.

You need to fix your loopback interface, because other things will fail (unexpectedly) without it.

Or update /etc/mysql/my.cnf with

Code: Select all

bind-address            = 0.0.0.0
My router is applied to give ip's by mac.

But comment the line is the best solution for me.

Return to “Advanced users”