qooshie
By:
qooshie

Mysql (+ more) errors in new droplet

October 21, 2014 3.2k views

Hi,

Hey everyone, for the past 15 days i've been strugling with problems on my droplet since I've lost permission rights on my old one and hence decided to create a new droplet. But it seems im still on a dead end with this one.

So the story goes something like this: I tried several times to upload files through FTP and didn't work, tried to see if there was a problem with the permissions and couldn't figure that out and then I've noticed that the small files (e.g 54bytes ) were sent just fine, so I then tried to increase the limit from 1024 to something 102400 .
During that procedure I found out that under /etc/my.cnf did not exist. So I created a modified copy from /usr/share/doc/mysql-server-5.5/examples/my-small.cnf
Then I increased the limits from etc/security/limits.conf
And also installed nhm in order for the "show" command to be displayed. (Running: show global variables like 'open%'; ) to verify that the limit was increased.

After this I tried " service mysqld restart "
and got an error: unrecognized service.

Then a apache restart:
service apache2 restart

  • Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified doma in name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message [ OK ]

Postfix was not set up. Start with
cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
. If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for libc-bin (2.19-0ubuntu6.3) ...

So I logged into mysql (mysql -u root -p )
and got a:
mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

And here is my systems info:

Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-36-generic x86_64)

System information as of Tue Oct 21 07:10:59 EDT 2014

System load: 0.02 Processes: 86
Usage of /: 9.0% of 29.40GB Users logged in: 0
Memory usage: 21% IP address for eth0: 188.226.242.58
Swap usage: 0%

Any help or thoughts whatsoever please, I'm really confused right now.


Also, some extra info that might help:

ps -eaf | grep -in mysql
85:root 13661 11832 0 08:21 pts/0 00:00:00 grep --color=auto -in mysql

sudo service mysql start
start: Job failed to start

service mysql stop
stop: Unknown instance:

tail -n 25 /var/log/mysql/error.log
141021 8:24:19 InnoDB: Completed initialization of buffer pool
141021 8:24:19 InnoDB: highest supported file format is Barracuda.
141021 8:24:19 InnoDB: Waiting for the background threads to start
141021 8:24:20 InnoDB: 5.5.38 started; log sequence number 1595685
141021 8:24:20 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
141021 8:24:20 [Note] - '127.0.0.1' resolves to '127.0.0.1';
141021 8:24:20 [Note] Server socket created on IP: '127.0.0.1'.
141021 8:24:20 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './mysql/db.frm'
141021 8:24:20 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect information in file: './mysql/db.frm'
141021 8:24:21 [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.
141021 8:24:21 [Note] Plugin 'FEDERATED' is disabled.
141021 8:24:21 InnoDB: The InnoDB memory heap is disabled
141021 8:24:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
141021 8:24:21 InnoDB: Compressed tables use zlib 1.2.8
141021 8:24:21 InnoDB: Using Linux native AIO
141021 8:24:21 InnoDB: Initializing buffer pool, size = 128.0M
141021 8:24:21 InnoDB: Completed initialization of buffer pool
141021 8:24:21 InnoDB: highest supported file format is Barracuda.
141021 8:24:21 InnoDB: Waiting for the background threads to start
141021 8:24:22 InnoDB: 5.5.38 started; log sequence number 1595685
141021 8:24:22 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
141021 8:24:22 [Note] - '127.0.0.1' resolves to '127.0.0.1';
141021 8:24:22 [Note] Server socket created on IP: '127.0.0.1'.
141021 8:24:22 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './mysql/db.frm'
141021 8:24:22 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect
information in file: './mysql/db.frm'

Thanks in advance to anyone willing to help !

2 comments
  • This error seems to be your main problem. It's why it will not MySql will not start up correctly:

    141021 8:24:22 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './mysql/db.frm'
    141021 8:24:22 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect 
    information in file: './mysql/db.frm'
    

    Were you ever able to start MySql on this droplet? Did you try to import a database from somewhere else? My initial guess is that the database was not imported correctly or was corrupt.

  • Agree with @asb
    It appears that this was imported via the data files from an older version of MySQL.

    You need to do a database dump on the old system via

    mysqldump --all-databases > dump.sql
    

    then copy the file over, and run

    mysql -u root -p < dump.sql
    
2 Answers

Thank you for your replies !

@asb I was able to start MySql on this droplet, and yes i tried to move a database from my previous droplet to this one, but since I couldn't login to mysql on that droplet, and couldn't use rsync I copied the database through FTP.

@jon231325 trying to run: mysqldump --all-databases > dump.sql
I get: mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) when trying to connect

Thats why I tried copy them through Filezilla and then upload them again to the new one.
So at this point im currently unable to login to mysql through both of my droplets..

Any suggestions?

Ahh.

OK. This may be easier than thought.

First, have you copied your my.cnf file over as well? It would be best to get the file as close as possible (generally speaking), then run this:

chown mysql:mysql /var/lib/mysql -R

then

service mysql start
  • I still get a "start: Job failed to start "

  • Have you modified MySQL in any way after installing it? If not, try completely uninstalling it and re-installing it again (ALL DATA will be erased):

    sudo apt-get purge 'mysql*'
    sudo rm -r /var/lib/mysql
    sudo apt-get install mysql-server mysql-client
    
  • ok. I will do that, but is there a way I can migrate my sql databases from one droplet to another through Ftp even if its a different MYSQL version between the two droplets?

  • If MySQL is running on the origin server, run this:

    mysqldump -u root -p --all-databases > full_dump.sql
    

    ^^^ Run this on the origin server, not the destination.

    copy full_dump.sql over to the new server, then run this on the destination:

    (Thanks @kamaln7 for the syntax so I didn't have to grab it)

    apt-get purge 'mysql*'
    rm -rf /var/lib/mysql
    rm -rf /etc/mysql/
    apt-get install mysql-server mysql-client
    service mysql start
    mysql -u root -p < full_dump.sql
    

    This will reset MySQL on the destination server, then re-import the data.

  • Update! I run:
    root@qooshie:~# apt-get install mysql-server mysql-client

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following package was automatically installed and is no longer required:
    libbsd0
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
    libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-client-core-5.5 mysql-common
    mysql-server-5.5 mysql-server-core-5.5
    Suggested packages:
    tinyca mailx
    The following NEW packages will be installed:
    libdbd-mysql-perl libmysqlclient18 mysql-client mysql-client-5.5 mysql-client-core-5.5
    mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
    0 upgraded, 9 newly installed, 0 to remove and 1 not upgraded.
    Need to get 22.6 kB/25.6 MB of archives.
    After this operation, 89.4 MB of additional disk space will be used.

    Do you want to continue [Y/n]? Y

    Err http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client all 5.5.38-0ubuntu0.12 .04.1
    404 Not Found [IP: 91.189.91.14 80]
    Err http://security.ubuntu.com/ubuntu/ precise-security/main mysql-client all 5.5.38-0ubuntu0. 12.04.1
    404 Not Found [IP: 91.189.88.149 80]
    Err http://security.ubuntu.com/ubuntu/ precise-security/main mysql-server all 5.5.38-0ubuntu0. 12.04.1
    404 Not Found [IP: 91.189.88.149 80]
    Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client_5.5.38-0u buntu0.12.04.1all.deb 404 Not Found [IP: 91.189.88.149 80]
    Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server
    5.5.38-0u buntu0.12.04.1_all.deb 404 Not Found [IP: 91.189.88.149 80]
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

    root@qooshie:~# service mysql start
    mysql: unrecognized service

    So, I run sudo apt-get update.

    and once it was finished I was prompted to change mysql root password, did that
    and then tried to login mysql -u root -p and got a
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    root@qooshie:~# service apache2 restart
    apache2: Syntax error on line 239 of /etc/apache2/apache2.conf: Could not open configuration file /etc/phpmyadmin/apache.conf: No such file or directory
    Action 'configtest' failed.
    The Apache error log may have more information.
    ...fail!

    root@qooshie:~# service mysql restart
    mysql stop/waiting
    mysql start/running, process 16535

    and.. I'm still confused..

  • As the error says:

    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

    Try running apt-get update and then running apt-get install mysql-server mysql-client again.

    apache2: Syntax error on line 239 of /etc/apache2/apache2.conf: Could not open configuration file /etc/phpmyadmin/apache.conf: No such file or directory

    Apache is trying to load /etc/phpmyadmin/apache.conf but it doesn't exist. Open /etc/apache2/apache2.conf and delete the line that says Include /etc/phpmyadmin/apache.conf:

    nano +239 /etc/apache2/apache2.conf
    
  • Thank you so much kamain7, that seems to have worked just fine.
    The only thing left now its that I seem to have a problem login in, I know that my default mysql password now is "password" , but still cant run mysql -u root - p without getting an error
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: YES)'

    It may have something to do with the result of running service apache2 restart
    and getting a

    • Restarting web server apache2
      apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

    Thank you.

  • error: 'Access denied for user 'root'@'localhost' (using password: YES)'

    The error is basically saying that you are supplying the wrong password for MySQL's root user. Make sure you are not passing your system's root user's password which is unrelated to MySQL's root user.

    If you've forgotten the password, you can reset it: Recover MySQL root Password - nixCraft.

  • Thank you so much kamain7 for your time and effort.
    Everything is working now, and after so many days I now have control again !!

    I can't thank you enough !!

  • Awesome! Glad I could help :)

Have another answer? Share your knowledge.