笔者在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. Spring Boot/Spring Cloud

    104.什么是 spring boot?         在Spring框架这个大家族中,产生了很多衍生框架,比如 Spring.SpringMvc框架等,Spring的核心内容在于控制反转(IOC) ...

  2. django模板语言循环字典,及forloop

    views: from django.shortcuts import render,redirect from django.shortcuts import HttpResponse # Crea ...

  3. 【mysql】批量更新数据

    概述 批量更新mysql数据表数据,上网搜索基本都会说4~5方法,本人使用的更新方式为: INSERT ... ON DUPLICATE KEY UPDATE Syntax 可参见官方网站:inser ...

  4. DokuWiki 命名空间管理

    为了更好的组织结构,Dokuwiki提供了命名空间这个功能,那怎么管理命名空间的,其实可以安装插件去管理 Add New Page Plugin:新建界面 https://www.dokuwiki.o ...

  5. 创建一个HTTP接口测试

    jmeter Apache JMeter是Apache组织开发的基于Java的压力测试工具. Apache jmeter 可以用于对静态的和动态的资源(文件,Servlet,Perl脚本,java 对 ...

  6. day2模块初识别

    sys_mod.py import sys print(sys.argv) #['C:/Users/Administrator/desktop/s17/day2/sys_mod.py'] 打印脚本的绝 ...

  7. PP.io的三个阶段,“强中心”——“弱中心”——“去中心”

    什么是PP.io? PP.io是我和Bill发起的存储项目,目的在于为开发者提供一个去中心化的存储和分发平台,能做到更便宜,更高速,更隐私. 当然做去中心化存储的项目也有好几个,FileCoin,Si ...

  8. Python安装与Pycharm使用入门

    一.安装Python 1.Linux下安装 一般系统默认已安装2.6.6版本,升级成2.7版本, 但 2.6 不能删除,因为系统对它有依赖,epel源里最新的也是2.6版本,所以以源代码的方式安装2. ...

  9. 编写高质量java代码151个建议

    http://blog.csdn.net/aishangyutian12/article/details/52699938 第一章  Java开发中通用的方法和准则 建议1:不要在常量和变量中出现易混 ...

  10. c# 对象的深拷备

    C# 引用类型对象在拷备时,一般有浅拷备与深拷备,浅拷备指向的是同一对象的引用地址,一个对象的修改必然会影响另一个对象,而深拷备是直接拷备对象的内容,而不是引用,拷备后的对象拥有新的引用,这里主要介绍 ...