笔者在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. laravel 使用 php artisan make:model到指定目录(controller同理)

    在 \app\Models 目录下创建一个BusinessProduct模型文件 D:\htdocs\PHPTutorial\WWW\gf>php artisan make:model /Mod ...

  2. 设置Tomcat管理员用户名和密码

    http://dove19900520.iteye.com/blog/1774980 今天tomcat出点问题,然后我就想进入tomcat manager看看,结果怎么输入密码都不行,后来网上查了查才 ...

  3. [UE4]Widget Switcher:控件切换器

    一.Widget Switcher可以有很多子控件,但一次只会显示一个子控件.所有的子控件默认情况下都是充满整个Widget Switcher容器 二.Widget Switcher.Active W ...

  4. js跨域传值,兼容ie8以上

    js跨域传值,兼容ie8以上 事先说明,此方法并不支持ie8,如果想要支持ie8的话,需要用这种思路(来自微软): if (window.addEventListener) { window.addE ...

  5. ELK+Beats日志分析系统部署

    一.            名词介绍: E:ElasticSearch 搜索,简称es L:Logstash 管理日志和事件的工具 K:Kibana 功能强大的数据显示客户端 Beats 轻量级数据传 ...

  6. SpringBoot 之 MVC

    SpringBoot MVC 和静态资源 首先,我们一定要搞清楚,mvc 配置和 static 配置的联系和区别. mvc 配置其实就是给 spring mvc 框架用的, 具体来说, 比如 @Req ...

  7. SpringMVC 请求全过程漫谈

    SpringMVC 请求全过程漫谈 SpringMVC 跟其他的mvc框架一样,如 struts,webwork, 本质上都是 将一个 http 请求(request)进行各种处理, 然后返回resp ...

  8. python大法好——模块(内置模块未完)

    模块 模块是非常简单的Python文件,单个Python文件就是一个模块,两个文件就是两个模块. Python模块有什么作用? 1.模块内有许多函数方法,利用这些方法可以更简单的完成许多工作.2.模块 ...

  9. css学习2

    1.垂直居中 -父元素高度确定的单行文本: 设置父元素的 height 和 line-height  高度一致来实现的.(height: 该元素的高度:line-height: 行高(行间距),指在文 ...

  10. c++符号常量:limits头文件

    CHAR_BIT char的位数 CHAR_MAX char的最大值 CHAR_MIN char的最小值 SCHAR_MAX signed char的最大值 SCHR_MIN signedchar的最 ...