我无法启动 MySQL 服务器。我的机器是 Ubuntu 14.04,其配置如下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
以下是来自的令人反感的台词/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'.
当然,任何这些插件都存在于/usr/lib/mysql/plugin
。我不知道它们是否应该在任何其他目录中,但是对于错误行,似乎正在标准目录中查找插件,因为插件名称不是绝对路径。
当我尝试重新启动服务器时,它冻结了。我尝试连接时的错误是:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
但我认为套接字文件尚未被创建,因为启动过程刚刚尚未成功结束。
这不是全新安装。我从几年前就开始使用 mysql 服务了。我有一段时间没使用服务器了,所以我不记得我是否做了一些导致某些东西崩溃的更新。
sudo service mysql start
这是最后一次(上次停止后)的完整日志:
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]
由于服务器反复尝试启动,因此该日志记录块会一遍又一遍重复。
取消启动过程后,sudo service mysql status
抛出:
mysql start/post-start, process 31967
post-start process 31968
最后(删除了评论),
$> 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/
答案1
数据目录不存在或不可写入。
请检查您的配置文件和 datadir 的所有权、权限和位置,ls -la /var/lib|grep mysql
并根据您的情况进行修复my.cnf
。
答案2
问题是我前段时间内存不够了,所以我符号链接/usr/share
到另一个专门创建的分区来解决内存问题。
即使将 的位置更改lc-message-dir
为 直接指向/my-partition/usr/share/mysql
也未能解决问题。看来mysql
至少在处理非标准位置时,ubuntu 14.04 中存在某种问题,可能是因为apparmor
或者您弄清楚是什么原因。
所以我所做的只是重新创建/usr/share
文件夹和符号链接,只有最大的文件夹(,,,man
等)到我的额外分区(内存问题仍然存在)并且服务器再次正常运行。texmf
icons
更具体地说,似乎是服务器无法找到/usr/share/mysql/errmsg.sys
,从而停止了服务器的启动,但此错误仅在尝试直接通过 运行服务器时出现mysqladmin
。
错误链接。