无法诊断我的问题(MySQL无法启动)。任何帮助将不胜感激。
在Ubuntu 16.04上
步骤1 -服务mysql启动
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
第2步- systemctl状态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 Mon 2016-10-31 22:40:22 UTC; 11s ago
Process: 9780 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 9777 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 9780 (code=exited, status=1/FAILURE); : 9781 (mysql-systemd-s)
CGroup: /system.slice/mysql.service
└─control
├─9781 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─9806 sleep 1
步骤3 - journalctl -xe
Oct 31 22:42:32 sshd[10033]: Received disconnect from 121.18.238.109 port 34577:11: [preauth]
Oct 31 22:42:32 sshd[10033]: Disconnected from 121.18.238.109 port 34577 [preauth]
Oct 31 22:42:32 sshd[10033]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=121.18.238.109 user=root
Oct 31 22:42:35 sshd[10090]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.23 user=root
Oct 31 22:42:37 sshd[10090]: Failed password for root from 116.31.116.23 port 52791 ssh2
Oct 31 22:42:39 sshd[10090]: Failed password for root from 116.31.116.23 port 52791 ssh2
Oct 31 22:42:41 sshd[10090]: Failed password for root from 116.31.116.23 port 52791 ssh2
Oct 31 22:42:41 sshd[10090]: Received disconnect from 116.31.116.23 port 52791:11: [preauth]
Oct 31 22:42:41 sshd[10090]: Disconnected from 116.31.116.23 port 52791 [preauth]
Oct 31 22:42:41 sshd[10090]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.23 user=root
Oct 31 22:42:43 sshd[10084]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=121.18.238.109 user=root
Oct 31 22:42:45 sshd[10084]: Failed password for root from 121.18.238.109 port 40812 ssh2
Oct 31 22:42:48 sshd[10084]: Failed password for root from 121.18.238.109 port 40812 ssh2
Oct 31 22:42:50 sshd[10084]: Failed password for root from 121.18.238.109 port 40812 ssh2
Oct 31 22:42:50 sshd[10084]: Received disconnect from 121.18.238.109 port 40812:11: [preauth]
Oct 31 22:42:50 sshd[10084]: Disconnected from 121.18.238.109 port 40812 [preauth]
Oct 31 22:42:50 sshd[10084]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=121.18.238.109 user=root
Oct 31 22:42:56 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.
Oct 31 22:42:56 systemd[1]: mysql.service: Unit entered failed state.
Oct 31 22:42:56 systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 31 22:42:56 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Oct 31 22:42:56 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.
Oct 31 22:42:56 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.
Oct 31 22:42:56 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 31 22:43:04 sshd[10141]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=121.18.238.109 user=root
Oct 31 22:43:06 sshd[10141]: Failed password for root from 121.18.238.109 port 56169 ssh2
Oct 31 22:43:11 sshd[10141]: Failed password for root from 121.18.238.109 port 56169 ssh2
Oct 31 22:43:13 sshd[10141]: Failed password for root from 121.18.238.109 port 56169 ssh2
Oct 31 22:43:14 sshd[10178]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.23 user=root
Oct 31 22:43:17 sshd[10178]: Failed password for root from 116.31.116.23 port 60094 ssh2
Oct 31 22:43:18 sshd[10178]: Failed password for root from 116.31.116.23 port 60094 ssh2
Oct 31 22:43:20 sshd[10178]: Failed password for root from 116.31.116.23 port 60094 ssh2
Oct 31 22:43:20 sshd[10178]: Received disconnect from 116.31.116.23 port 60094:11: [preauth]
Oct 31 22:43:20 sshd[10178]: Disconnected from 116.31.116.23 port 60094 [preauth]
Oct 31 22:43:20 sshd[10178]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.23 user=root
Oct 31 22:43:21 sshd[10141]: Received disconnect from 121.18.238.109 port 56169:11: [preauth]
Oct 31 22:43:21 sshd[10141]: Disconnected from 121.18.238.109 port 56169 [preauth]
Oct 31 22:43:21 sshd[10141]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=121.18.238.109 user=root
更多信息可以帮助。我累了mysql
但收到了ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
此外,这里是错误日志
2016-10-31T19:06:58.590888Z 0 [Note] Giving 0 client threads a chance to die gracefully
2016-10-31T19:06:58.591364Z 0 [Note] Shutting down slave threads
2016-10-31T19:06:58.592730Z 0 [Note] Forcefully disconnecting 0 remaining clients
2016-10-31T19:06:58.592792Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2016-10-31T19:06:58.598944Z 0 [Note] Binlog end
2016-10-31T19:06:58.701931Z 0 [Note] Shutting down plugin 'validate_password'
2016-10-31T19:06:58.705709Z 0 [Note] Shutting down plugin 'ngram'
2016-10-31T19:06:58.705751Z 0 [Note] Shutting down plugin 'ARCHIVE'
2016-10-31T19:06:58.705790Z 0 [Note] Shutting down plugin 'partition'
2016-10-31T19:06:58.705812Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2016-10-31T19:06:58.705844Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2016-10-31T19:06:58.706964Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2016-10-31T19:06:58.707001Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2016-10-31T19:06:58.707020Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2016-10-31T19:06:58.707037Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2016-10-31T19:06:58.707054Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2016-10-31T19:06:58.707208Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2016-10-31T19:06:58.707235Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2016-10-31T19:06:58.707255Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2016-10-31T19:06:58.707271Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2016-10-31T19:06:58.707286Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2016-10-31T19:06:58.707306Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2016-10-31T19:06:58.707322Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2016-10-31T19:06:58.707340Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2016-10-31T19:06:58.707358Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2016-10-31T19:06:58.707411Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2016-10-31T19:06:58.707432Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2016-10-31T19:06:58.707449Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2016-10-31T19:06:58.707467Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2016-10-31T19:06:58.707484Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2016-10-31T19:06:58.707499Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2016-10-31T19:06:58.707516Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2016-10-31T19:06:58.707534Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2016-10-31T19:06:58.707566Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2016-10-31T19:06:58.707587Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2016-10-31T19:06:58.707603Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2016-10-31T19:06:58.707619Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2016-10-31T19:06:58.707636Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2016-10-31T19:06:58.707654Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2016-10-31T19:06:58.707672Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2016-10-31T19:06:58.707698Z 0 [Note] Shutting down plugin 'InnoDB'
2016-10-31T19:06:58.711649Z 0 [Note] InnoDB: FTS optimize thread exiting.
2016-10-31T19:06:58.714623Z 0 [Note] InnoDB: Starting shutdown...
2016-10-31T19:06:58.819989Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2016-10-31T19:06:58.820088Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2016-10-31T19:06:58.820228Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2016-10-31T19:06:58.820416Z 0 [ERROR] InnoDB: Cannot open '/var/lib/mysql/ib_buffer_pool.incomplete' for writing: Permission denied
2016-10-31T19:07:00.692529Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1333673446
2016-10-31T19:07:00.693394Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2016-10-31T19:07:00.693505Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2016-10-31T19:07:00.693546Z 0 [Note] Shutting down plugin 'MEMORY'
2016-10-31T19:07:00.693586Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2016-10-31T19:07:00.693933Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2016-10-31T19:07:00.695547Z 0 [Note] Shutting down plugin 'MyISAM'
2016-10-31T19:07:00.696705Z 0 [Note] Shutting down plugin 'CSV'
2016-10-31T19:07:00.696747Z 0 [Note] Shutting down plugin 'sha256_password'
2016-10-31T19:07:00.696758Z 0 [Note] Shutting down plugin 'mysql_native_password'
2016-10-31T19:07:00.696766Z 0 [Note] Shutting down plugin 'keyring_file'
2016-10-31T19:07:00.728590Z 0 [Note] Shutting down plugin 'binlog'
2016-10-31T19:07:00.737815Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
3条答案
按热度按时间camsedfj1#
我有一个问题,在我的情况下,问题是与日志文件,因为这个文件被删除。我通过重新创建这个文件'/var/log/mysql/error.log'解决了这个问题,之后我的服务器正常启动。
u1ehiz5o2#
你的mysql数据目录被丢弃了,它保存了所有的数据库,包括
mysql
,sys
和身份验证文件。您需要重新初始化
mysql
数据库,方法是新建空的mysql
base
&data
目录。您可以按照mysqld data directory initialization中的步骤操作您可以使用以下
mysqld
轻松重置密码从您的Linux变体root登录重置密码。否则,它的一点困难,以找出生成的密码,你需要有与
init-file
的设置,我认为。因为对我来说,这个过程不会显示任何随机密码。以下两种选择都可以使用我认为。我不能再去了。但你可以尝试它正在生成和显示随机密码。
文章称
使用--initialize-insecure,(可以使用或不使用--initialize,因为--initialize-insecure意味着--initialize),服务器不会生成密码或将其标记为过期,而是写入警告消息
要重置密码,
umuewwlo3#
尝试使用
sudo service mysql start
启动mysqld服务。问题似乎是访问权限-错误意味着mysqld没有访问目录的权限。