笔者在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. jQuery基础(三)事件

    1.鼠标事件 jQuery鼠标事件之click与dblclick事件 click方法用于监听用户单击操作,dbclick方法用于监听用户双击操作. 方法一:$ele.click() 绑定$ele元素, ...

  2. 18.1 volatile的作用

    volatile的作用是作为指令关键字,确保本条指令不会因编译器的优化而省略,且要求每次直接读值. 1.编译器的优化 在本次线程内,当读取一个变量时,为提高存取速度,编译器优化时有时会先把变量读取到一 ...

  3. 微信支付,退款时,出现了内部错误-网站中X509Certificate2加载证书时出错

    今天给阿里云,虚拟主机 网站配置了加密证书文件,用类X509Certificate2加载证书文件时,一直报出现了内部错误,但是Demo中用控制台程序加载证书没任何问题 读取证书文件的语句: X509C ...

  4. Flask--(项目准备)--框架搭建,配置文件抽取,业务逻辑抽取

    抽取配置文件: import logging from redis import StrictRedis class Config(object): """项目的配置&q ...

  5. Android中的Sqlite中的onCreate方法和onUpgrade方法的执行时机

    1.今天在做数据库升级的时候,遇到一个问题,就是onCreate方法和onUpgrade方法的执行时机的问题,这个当时在操作的时候,没有弄清楚,很是迷糊,后来看了相关的博客由于转发受限所以copy了一 ...

  6. 物化视图SQL

    物化视图SQL,如果没有结果集,就证明数据库中不存在物化视图 select a.owner,'' column_name,a.table_name,b.segment_name,b.segment_t ...

  7. 【亲测显式等待】Selenium:元素等待的4种方法

    Selenium:元素等待的4种方法 1.使用Thread.sleep(),这是最笨的方法,但有时候也能用到而且很实用.   2.隐式等待,隐性等待是指当要查找元素,而这个元素没有马上出现时,告诉We ...

  8. 【笔记】range函数在py3里面的处理及numpy库效率比较【原创】

    今天看了一下,numpy数组操作其中一段代码,主要是测试用纯python和numpy之间的性能问题 在py2环境下,代码如下: def pysum(n): a = range(n) b = range ...

  9. 新部署tomcat,An error occurred at line: [1] index_jsp.java

    环境: centos6.5 32位 oracle jdk 1.8 tomcat 7 问题: yum install tomcat后,返回如下错误: [root@centos]~# curl -v ht ...

  10. Calendar打印日历

    package com.example.demo; import org.junit.Test; import org.junit.runner.RunWith; import org.springf ...