笔者在ubuntu下用 apt install mysql-server类似的命令安装mysql,

安装了最新版的mysql5.7,覆盖了操作系统内置的数据库mysql系统库。

最初启动mysql出错信息如下

service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

查看日志信息如下:

tail -100f /var/log/mysql/error.log
--27T23::.624983Z  [Warning] Changed limits: max_open_files:  (requested )
--27T23::.625097Z [Warning] Changed limits: table_open_cache: (requested )
--27T23::.803581Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--27T23::.805744Z [Note] /usr/sbin/mysqld (mysqld 5.7.-0ubuntu0.16.04.) starting as process ...
--27T23::.811597Z [Note] InnoDB: PUNCH HOLE support available
--27T23::.811655Z [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
--27T23::.811662Z [Note] InnoDB: Uses event mutexes
--27T23::.811667Z [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
--27T23::.811671Z [Note] InnoDB: Compressed tables use zlib 1.2.
--27T23::.811676Z [Note] InnoDB: Using Linux native AIO
--27T23::.812040Z [Note] InnoDB: Number of pools:
--27T23::.812208Z [Note] InnoDB: Using CPU crc32 instructions
--27T23::.814479Z [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = , chunk size = 128M
--27T23::.826619Z [Note] InnoDB: Completed initialization of buffer pool
--27T23::.829478Z [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
--27T23::.842451Z [Note] InnoDB: Highest supported file format is Barracuda.
--27T23::.851779Z [Note] InnoDB: Creating shared tablespace for temporary tables
--27T23::.851863Z [Note] InnoDB: Setting file './ibtmp1' size to MB. Physically writing the file full; Please wait ...
--27T23::.887533Z [Note] InnoDB: File './ibtmp1' size is now MB.
--27T23::.888429Z [Note] InnoDB: redo rollback segment(s) found. redo rollback segment(s) are active.
--27T23::.888458Z [Note] InnoDB: non-redo rollback segment(s) are active.
--27T23::.888905Z [Note] InnoDB: Waiting for purge to start
--27T23::.939190Z [Note] InnoDB: 5.7. started; log sequence number
--27T23::.939462Z [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
--27T23::.939724Z [Note] Plugin 'FEDERATED' is disabled.
--27T23::.941332Z [Note] InnoDB: Buffer pool(s) load completed at ::
--27T23::.945460Z [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
--27T23::.945498Z [Note] Server hostname (bind-address): '*'; port:
--27T23::.945538Z [Note] IPv6 is available.
--27T23::.945566Z [Note] - '::' resolves to '::';
--27T23::.945589Z [Note] Server socket created on IP: '::'.
2018-12-27T23:10:32.946334Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2018-12-27T23:10:32.946376Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
--27T23::.946415Z [ERROR] Aborting

解决方法如下:

https://serverfault.com/questions/789328/fatal-error-mysql-user-table-is-damaged-please-run-mysql-upgrade

vim /etc/mysql/mysqld.conf/mysql.cnf
[mysqld]添加以下内容
skip-grant-tables /etc/init.d/mysql start --skip-grant-tables && mysql_upgrade
service mysql restart

如果以上方法无效,完整删除mysql重新安装

apt remove mysql*
rm -rf /var/lib/mysql
apt install mysql-server mysql-client
dpkg --configure -a

其他参考:

https://fatdba.com/2017/11/15/mysql-startup-error-error-fatal-error-mysql-user-table-is-damaged/

https://serverfault.com/questions/527422/mysql-upgrade-is-failing-with-no-real-reason-given

linux下apt安装mysql导致mysql.user table is damaged的更多相关文章

  1. linux下yum安装指定的mysql版本

    因为直接使用yum安装的mysql会是默认版本5.1的版本  但是有的同学不满足又想要其他版本的怎么办呢? 曾时候我来提供一种方案(仅供参考): 我们可以使用rpm包来进行指定mysql版本的安装, ...

  2. LINUX下编译安装最新版本mysql

    通过参考其他文章 1.下载安装mysql-5.5.30.tar.gz与cmake.2.8.11.2.tar.gz (1)先安装cmake(mysql5.5以后是通过cmake来编译的) [root@ ...

  3. 在linux下手动安装 apache, php, mysql--终极版

    在linux下手动安装 apache, php, mysql: 参考: http://www.cnblogs.com/lufangtao/archive/2012/12/30/2839679.html ...

  4. Linux下yum安装MySQL

    写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...

  5. linux下如何安装mysql和redis

    linux下如何安装mysql(mariadb) linux下如何安装软件? 1. yum安装软件也得注意,一个是配置yum源 1.我们当前的是阿里云的yum源(下载速度特别快) 通过 yum ins ...

  6. linux下使用crontab定时备份MYSQL数据库的方法:

    摘要 linux下使用crontab定时备份MYSQL数据库的方法: 只需按照下面3步做,一切都在你的掌控之下: 第一步:在服务器上配置备份目录代码: ------------------------ ...

  7. windows下手动安装 Apache+php+mysql

    PHP 为什么先说php,因为apache的配置要写入php的一些路径 http://php.net/downloads.php  选择windows donwload 选择Thread Safe的版 ...

  8. 在一台Linux服务器上安装多个MySQL实例(一)--使用mysqld_multi方式

    (一)MySQL多实例概述 实例是进程与内存的一个概述,所谓MySQL多实例,就是在服务器上启动多个相同的MySQL进程,运行在不同的端口(如3306,3307,3308),通过不同的端口对外提供服务 ...

  9. Linux下mongodb安装及数据导入导出教程

    Linux下mongodb安装及数据导入导出教程 #查看linux发行版本 cat /etc/issue #查看linux内核版本号 uname -r 一.Linux下mongodb安装的一般步骤 1 ...

随机推荐

  1. CANVAS笔记

    bglayer.add(bgimage) /*后面的层会覆盖前面的,所以要放在上面的,就要后面才添加!*/ bglayer.add(this.shape1) Layer.destroy() layer ...

  2. .NET WebService 入门

    以 前写博客最主要的就是不知道写什么东西,现在感觉能写点东西,就是感觉博客随笔的标题挺难取的,最近工作中刚好用到了WebService,刚好可以写一 篇博客.去年工作的时候自己也用到过,只是知道调用一 ...

  3. SQL 语句 explain 分析

      分析索引的效率: > EXPLAIN sql; EXPLAIN 分析的结果的表头如下: id | select_type | table | partitions | type | poss ...

  4. Android开发 :androidstudio device offline

    使用设备调试的时候,偶尔的就会遇到androidstudio device offline,尽管尝试开启/关闭  USB调试 .都无济于事. 如果PC安装了360手机助手就好办了(我的360手机助手 ...

  5. unittest 出报告 并配合 jenkins,发现有用例错误,但是构建没出现红点 的解决方法

    加了个 判断 测试用例总数 和 测试运行成功数 是否一致的判断,不一致 就断言失败,jenkins哪里是红点

  6. List接口、Set接口和Map接口

    1.List和Set接口继承自Collection接口,而Map不是继承的Collection接口 Map没有继承Collection接口,Map提供key到value的映射;一个Map中不能包含相同 ...

  7. Problem B: 取石子

    转换成一个数在(0,X + Y)的加减问题 考虑一种使用线段树处理的方法, 维护前缀最大值, 前缀最小值, 前缀和, 然后查询的时候先询问右区间是否会同时碰到上下界, 会的话左区间无用直接递归右区间, ...

  8. Oracle 学习笔记(六)

    Oracle 数据库常用的闪回sql 语句及其它操作语句: --Oracle 数据库dml sql -- 查看当前用户所拥有的表 select * from tab; --表空间,auto: 自动管理 ...

  9. oracle12 安装

    oracle    oracle orcl    orcl

  10. py库: arrow (时间)

    arrow是个时间日期库,简洁易用.支持python3.6 https://arrow.readthedocs.io/en/latest/ arrow官网api https://github.com/ ...