MySql服务无法启动[ubuntu]

时间:2018-04-24 19:30:56

标签: mysql ubuntu amazon-ec2 ubuntu-16.04

今天大约6:23 UTC,我在Amazon EC2中的Ubuntu Server 16.04进行了自动更新。从这时起,我的MySql服务器拒绝启动。

起初他告诉我apparmor配置错误(就像这里:mysql wont start Ubuntu 16.04.2 x64)我修好了。

现在,当我尝试像这样启动mysql服务时:

:~$ sudo /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service 
failed because the control process exited with error code. See "systemctl 
status mysql.service" and "journalctl -xe" for details.
failed!

systemctl status mysql.service

:~$ sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Tue 2018-04-24 19:01:31 UTC; 27s ago 
Process: 22818 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 22809 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre         (code=exited, status=0/SUCCESS)
Main PID: 22818 (code=exited, status=1/FAILURE);         : 22819 (mysql-systemd-s)
Tasks: 2
Memory: 324.0K
CPU: 287ms
CGroup: /system.slice/mysql.service
       └─control
         ├─22819 /bin/bash /usr/share/mysql/mysql-systemd-start post
         └─22903 sleep 1

Apr 24 19:01:31 ip-172-31-38-155 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 24 19:01:31 ip-172-31-38-155 systemd[1]: Stopped MySQL Community Server.
Apr 24 19:01:31 ip-172-31-38-155 systemd[1]: Starting MySQL Community Server...
Apr 24 19:01:33 ip-172-31-38-155 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

并且journalctl -ex看起来像这样:

journalctl -xe
-- The result is failed.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: mysql.service: Unit entered failed state.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Apr 24 19:05:41 ip-172-31-38-155 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Apr 24 19:05:43 ip-172-31-38-155 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: mysql.service: Unit entered failed state.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has finished shutting down.
Apr 24 19:06:12 ip-172-31-38-155 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has begun starting up.
Apr 24 19:06:14 ip-172-31-38-155 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

虽然cat /var/log/mysql/error.log | grep ERROR打印了这些错误的负载:

2018-04-24T19:10:22.941983Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-04-24T19:10:22.942643Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-04-24T19:10:22.942683Z 0 [ERROR] Aborting

cat /var/log/error.log的整个周期看起来像这样:

2018-04-24T19:14:01.701232Z 0 [Note] Shutting down plugin 'ngram'
2018-04-24T19:14:01.701238Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2018-04-24T19:14:01.701241Z 0 [Note] Shutting down plugin 'partition'
2018-04-24T19:14:01.701243Z 0 [Note] Shutting down plugin 'ARCHIVE'
2018-04-24T19:14:01.701246Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2018-04-24T19:14:01.701249Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2018-04-24T19:14:01.701251Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2018-04-24T19:14:01.701253Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2018-04-24T19:14:01.701256Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2018-04-24T19:14:01.701258Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2018-04-24T19:14:01.701260Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2018-04-24T19:14:01.701263Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2018-04-24T19:14:01.701265Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2018-04-24T19:14:01.701267Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2018-04-24T19:14:01.701270Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2018-04-24T19:14:01.701272Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2018-04-24T19:14:01.701274Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2018-04-24T19:14:01.701277Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2018-04-24T19:14:01.701279Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2018-04-24T19:14:01.701282Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2018-04-24T19:14:01.701284Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2018-04-24T19:14:01.701286Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2018-04-24T19:14:01.701289Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2018-04-24T19:14:01.701291Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2018-04-24T19:14:01.701293Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2018-04-24T19:14:01.701296Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2018-04-24T19:14:01.701298Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2018-04-24T19:14:01.701300Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2018-04-24T19:14:01.701303Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2018-04-24T19:14:01.701305Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2018-04-24T19:14:01.701307Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2018-04-24T19:14:01.701310Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2018-04-24T19:14:01.701312Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2018-04-24T19:14:01.701314Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2018-04-24T19:14:01.701317Z 0 [Note] Shutting down plugin 'InnoDB'
2018-04-24T19:14:01.701363Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-04-24T19:14:01.701444Z 0 [Note] InnoDB: Starting shutdown...
2018-04-24T19:14:01.701486Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2018-04-24T19:14:01.701522Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180424 19:14:01 (/var/lib/mysql/ib_buffer_pool was empty)
2018-04-24T19:14:01.701533Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-04-24T19:14:01.701632Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180424 19:14:01
2018-04-24T19:14:03.309269Z 0 [Note] InnoDB: Shutdown completed; log sequence number 8715994
2018-04-24T19:14:03.310751Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-04-24T19:14:03.310767Z 0 [Note] Shutting down plugin 'MyISAM'
2018-04-24T19:14:03.310781Z 0 [Note] Shutting down plugin 'CSV'
2018-04-24T19:14:03.310794Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-04-24T19:14:03.310840Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-04-24T19:14:03.310844Z 0 [Note] Shutting down plugin 'MEMORY'
2018-04-24T19:14:03.310848Z 0 [Note] Shutting down plugin 'sha256_password'
2018-04-24T19:14:03.310850Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-04-24T19:14:03.310975Z 0 [Note] Shutting down plugin 'binlog'
2018-04-24T19:14:03.311078Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2018-04-24T19:14:32.669339Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-04-24T19:14:32.669378Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-04-24T19:14:32.820589Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-24T19:14:32.822172Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22-0ubuntu0.16.04.1) starting as process 25440 ...
2018-04-24T19:14:32.826095Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-04-24T19:14:32.826121Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-24T19:14:32.826125Z 0 [Note] InnoDB: Uses event mutexes
2018-04-24T19:14:32.826129Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-04-24T19:14:32.826133Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-04-24T19:14:32.826136Z 0 [Note] InnoDB: Using Linux native AIO
2018-04-24T19:14:32.826367Z 0 [Note] InnoDB: Number of pools: 1
2018-04-24T19:14:32.826496Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-04-24T19:14:32.827971Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-04-24T19:14:32.835607Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-04-24T19:14:32.837529Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-04-24T19:14:32.849179Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-04-24T19:14:32.858128Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-04-24T19:14:32.858180Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-04-24T19:14:32.892813Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-04-24T19:14:32.893685Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-04-24T19:14:32.893696Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-04-24T19:14:32.893952Z 0 [Note] InnoDB: Waiting for purge to start
2018-04-24T19:14:32.944316Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 8715994
2018-04-24T19:14:32.944678Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2018-04-24T19:14:32.944791Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2018-04-24T19:14:32.945139Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-24T19:14:32.945192Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-04-24T19:14:32.945201Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-04-24T19:14:32.945209Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2018-04-24T19:14:32.945237Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-04-24T19:14:32.945363Z 0 [Warning] Failed to open optimizer cost constant tables

2018-04-24T19:14:32.945455Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2018-04-24T19:14:32.945497Z 0 [ERROR] Aborting

2018-04-24T19:14:32.945522Z 0 [Note] Binlog end

一方面,我看到error.log告诉我运行运行mysql_upgrade这是我无法做到的,因为数据库本身没有运行。 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist应该由initilize命令修复到服务上,因为服务本身没有运行,因此无法正常工作。

我没有一个线索,接下来要做什么。我个人最好的想法是重新安装MySql服务器并预先复制/ var / lib / mysql / mysql和/ etc / mysql目录,以便稍后将它们作为备份插入。

我希望你们中的任何人都能听到有关这个问题的内容,或者有任何想法该怎么做。最好保留我的数据。

我希望,我提供了您需要的所有信息。如果您还需要,请询问。

提前多多感谢!

0 个答案:

没有答案
相关问题