0

I cannot start the MySQL server. My machine is an Ubuntu 14.04 with mysql-5.6:

$> dpkg --get-selections | grep mysql
libdbd-mysql-perl               install
libmysqlclient18:amd64          install
libqt4-sql-mysql:amd64          install
mysql-client-5.6                install
mysql-client-core-5.6           install
mysql-common                    install
mysql-common-5.6                install
mysql-server-5.6                install
mysql-server-core-5.6           install
php5-mysql                      install

That's the offending lines from /var/log/mysql/error.log:

2017-11-06 20:10:54 9338 [Note] Plugin 'FEDERATED' is disabled.
2017-11-06 20:10:54 9338 [ERROR] 
2017-11-06 20:10:54 9338 [Warning] Couldn't load plugin named 'innodb' with soname 'ha_innodb.so'.
2017-11-06 20:10:54 9338 [ERROR] 
2017-11-06 20:10:54 9338 [Warning] Couldn't load plugin named 'federated' with soname 'ha_federated.so'.
2017-11-06 20:10:54 9338 [ERROR] 
2017-11-06 20:10:54 9338 [Warning] Couldn't load plugin named 'blackhole' with soname 'ha_blackhole.so'.
2017-11-06 20:10:54 9338 [ERROR] 
2017-11-06 20:10:54 9338 [Warning] Couldn't load plugin named 'archive' with soname 'ha_archive.so'.

Of course, any of those plugins exists in /usr/lib/mysql/plugin. I don't know if they should be in any other directory, but for the error lines, it seems that the plugins are being looked up in standard directories since plugin names are not absolute paths.

When I try to restart the server, it freezes. The error when I try to connect is:

 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

But I think that the socket file is not being created because the start process has just not ended successfully.

This is not a fresh installation. I'm using the mysql serve since a couple of years ago. I didn't use the server during a while so I don't remember if I did some update that crashed something.

That's the full log of the last sudo service mysql start (after a previous stop):

2017-11-06 20:26:23 29216 [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.
2017-11-06 20:26:23 29216 [Note] Plugin 'FEDERATED' is disabled.
2017-11-06 20:26:23 29216 [ERROR] 
2017-11-06 20:26:23 29216 [Warning] Couldn't load plugin named 'innodb' with soname 'ha_innodb.so'.
2017-11-06 20:26:23 29216 [ERROR] 
2017-11-06 20:26:23 29216 [Warning] Couldn't load plugin named 'federated' with soname 'ha_federated.so'.
2017-11-06 20:26:23 29216 [ERROR] 
2017-11-06 20:26:23 29216 [Warning] Couldn't load plugin named 'blackhole' with soname 'ha_blackhole.so'.
2017-11-06 20:26:23 29216 [ERROR] 
2017-11-06 20:26:23 29216 [Warning] Couldn't load plugin named 'archive' with soname 'ha_archive.so'.
2017-11-06 20:26:23 29216 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-11-06 20:26:23 29216 [Note] InnoDB: The InnoDB memory heap is disabled
2017-11-06 20:26:23 29216 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-11-06 20:26:23 29216 [Note] InnoDB: Memory barrier is not used
2017-11-06 20:26:23 29216 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-11-06 20:26:23 29216 [Note] InnoDB: Using Linux native AIO
2017-11-06 20:26:23 29216 [Note] InnoDB: Using CPU crc32 instructions
2017-11-06 20:26:23 29216 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-11-06 20:26:24 29216 [Note] InnoDB: Completed initialization of buffer pool
2017-11-06 20:26:24 29216 [Note] InnoDB: Highest supported file format is Barracuda.
2017-11-06 20:26:24 29216 [Note] InnoDB: 128 rollback segment(s) are active.
2017-11-06 20:26:24 29216 [Note] InnoDB: Waiting for purge to start
2017-11-06 20:26:24 29216 [Note] InnoDB: 5.6.33 started; log sequence number 415891008
2017-11-06 20:26:24 29216 [ERROR] Aborting

2017-11-06 20:26:24 29216 [Note] Binlog end
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'partition'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_METRICS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_CMP'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'INNODB_TRX'
2017-11-06 20:26:24 29216 [Note] Shutting down plugin 'InnoDB'
2017-11-06 20:26:24 29216 [Note] InnoDB: FTS optimize thread exiting.
2017-11-06 20:26:24 29216 [Note] InnoDB: Starting shutdown...
2017-11-06 20:26:25 29216 [Note] InnoDB: Shutdown completed; log sequence number 415891018
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'ARCHIVE'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'BLACKHOLE'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'MEMORY'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'MRG_MYISAM'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'MyISAM'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'CSV'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'sha256_password'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'mysql_old_password'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'mysql_native_password'
2017-11-06 20:26:25 29216 [Note] Shutting down plugin 'binlog'
2017-11-06 20:26:25 29216 [Note] 

That block of logging is repeated over and over because the server tries to start repeatedly.

After cancelling the start process, sudo service mysql status throws:

mysql start/post-start, process 31967
post-start process 31968

Lastly (with comments removed),

$> cat /etc/mysql/my.cnf
[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

bind-address        = 127.0.0.1

key_buffer      = 16M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8

myisam-recover         = BACKUP
query_cache_limit   = 1M
query_cache_size        = 16M

log_error = /var/log/mysql/error.log

expire_logs_days    = 10
max_binlog_size         = 100M

[mysqldump]
quick
quote-names
max_allowed_packet  = 16M

[mysql]

[isamchk]
key_buffer      = 16M

!includedir /etc/mysql/conf.d/
7
  • Check the ownership of /var/lib/mysql. It should be mysql while you probably have root.
    – Marco
    Nov 6, 2017 at 20:30
  • @Marco The folder is not mysql but mysqld. The user is mysql and the group root. The permissions of the folder are rwxr-xr-x.
    – ABu
    Nov 6, 2017 at 20:32
  • BUT you have /var/lib/mysql as datadir in your config file.
    – Marco
    Nov 6, 2017 at 20:34
  • @Marco Sorry sorry I was looking in the run folder. I have, in /var/run, the folder mysqld, which is empty and has the permissions I said above (rwxr-xr-x mysql:root). In var/lib, I have mysql (rwx------ mysql:mysql), mysql-files (rwx------ mysql:mysql) and mysql-upgrade (rxwr--xr--x root:root).
    – ABu
    Nov 6, 2017 at 20:40
  • After your last comment I still confirm my answer. Non writeable. Check permissions.
    – Marco
    Nov 6, 2017 at 20:42

2 Answers 2

0

The datadir is either non existent or non writeable.

Please check your config files and datadir’s ownership, permissions and location with ls -la /var/lib|grep mysql and fix according to your my.cnf.

3
  • I have add g+rwx permissions to every mysql* folder in /var/lib/ and restart the server (the machine itself) and nothing changed. By the way, I have realized the /var/run is a soft link to /run, if it matters. Could I safely deinstall and install the server without loosing any existing database? apt-get has both mysql-server-5.5 and mysql-server-5.6.
    – ABu
    Nov 6, 2017 at 20:54
  • So I’d downvote my own answer if I could. :) move /var/lib/mysql elsewhere and then you won’t loose anything even with an apt purge. Backup /etc/mysql just in case and please AVOID using comments as a chat.
    – Marco
    Nov 6, 2017 at 20:58
  • read my own answer if you are curious.
    – ABu
    Nov 6, 2017 at 23:16
-1

The problem was that I get out of memory some time ago and I symlinked /usr/share to another partition created ad-hoc to solve my memory problem.

And even changing the location of the lc-message-dir to point directly to /my-partition/usr/share/mysql didn't solved the problem. It seems that mysql had some kind of problem in ubuntu 14.04 at least when dealing with non standard locations, maybe because of the apparmor or you figure it out what.

So what I did was just to recreated the /usr/share folders and symlinks only the biggest folders (man, texmf, icons, etc) to my extra partition (the memory problem still remains) and the server run fine again.

More concretely, it seems, is that the server wasn't able to find /usr/share/mysql/errmsg.sys, which stopped the start of the server, but this error only appeared when trying to run the server directly by mysqladmin.

Bug link.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .