笔者在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. 二、tcp/ip基础知识

    一.TCP/IP的标准化 1.TCP/IP的含义 一般来说,TCP/IP是利用IP进行通信时所必须用到的协议群的统称. 具体点,IP或ICMP.TCP或UDP.TELENT或FTP.以及HTTP等都属 ...

  2. 解决java.lang.IllegalArgumentException: No converter found for return value of type 的问题

    controller返回一个dto,并且定义了@ResponseBody注解,表示希望将这个dto对象转换为json字符串返回给前端,但是运行时报错:nested exception is java. ...

  3. 函数和对象 及 prototype和__proto__

    对象有  __proto__ 函数有 prototype 对象的__proto__指向构造自己的函数的prototype 但有一例外 var Obj = {v:99}var pObj = Object ...

  4. Html 页面载入内容前,显示 loading 效果。

    Html 内容 loading部分: <div id="sys-loading" class=""><div class="spin ...

  5. PHP批量保存图片到服务器再上传阿里云

    /* * 批量传输产品主图到阿里云 */ public function transferImage(){ $num = 50; $p = isset($this->request->ge ...

  6. 用GDB调试程序(五)

    查看运行时数据———————        在你调试程序时,当程序被停住时,你可以使用print命令(简写命令为p),或是同义命令inspect来查看当前程序的运行数据.print命令的格式是:    ...

  7. Twisted网络库编程实例

    于这一周看了python的第三方网络库Twisted,英文看的头比较大,想看英文的话点击这里.如果英文很烂,可以看中文,这里.总的来说我了解到的主要包括以下三个东东:Factory.protocol和 ...

  8. Mysql相关问题集锦

    1:连接阿里云的服务器时,用navicate连接SSH时提示:或提示指到另一个IP从而进不去. SSH:expected key exchange group packet form server 解 ...

  9. sqlserver to oracle

    SELECT c.*, d .Organization_Name, d .ParentId, e.Roles_ID, e.Roles_Name FROM ( SELECT a.*, b.Organiz ...

  10. 创建列表明细应用1-使用fragment

    笔记自<Android编程权威指南第二版> 第七章,创建一个列表明细应用 fragment是一种控制器对象,activity可委派它完成一些任务,这些任务通常就是管理用户界面.(管理用户界 ...