博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql提示Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist解决方法...
阅读量:5240 次
发布时间:2019-06-14

本文共 2806 字,大约阅读时间需要 9 分钟。

一次重启mysql发现无法启动成功,通过检查mysql日志发现问题并解决了问题。 mysql启动失败的日志:

[root@nn ~]# tail -n 20 /var/log/mysqld.log130924 10:14:54 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist130924 10:14:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended130924 10:27:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist130924 10:27:09 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.130924 10:27:09  InnoDB: Initializing buffer pool, size = 8.0M130924 10:27:09  InnoDB: Completed initialization of buffer poolInnoDB: Log scan progressed past the checkpoint lsn 0 37356130924 10:27:09  InnoDB: Database was not shut down normally!InnoDB: Starting crash recovery.InnoDB: Reading tablespace information from the .ibd files...InnoDB: Restoring possible half-written data pages from the doublewriteInnoDB: buffer...InnoDB: Doing recovery: scanned up to log sequence number 0 44233130924 10:27:09  InnoDB: Starting an apply batch of log records to the database...InnoDB: Progress in percents: 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99InnoDB: Apply batch completed130924 10:27:10  InnoDB: Started; log sequence number 0 44233130924 10:27:10 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist130924 10:27:10 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

 解决方法:运行mysql_install_db --user=mysql --ldata=/var/lib/mysql/,运行结果如下,问题解决:

[root@nn ~]# mysql_install_db --user=mysql --ldata=/var/lib/mysql/Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password 'new-password'/usr/bin/mysqladmin -u root -h hostbus.net password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /usr ; /usr/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script![root@nn ~]#[root@nn ~]# service mysqld startStarting mysqld:                                           [  OK  ]

 

 

 

转载于:https://www.cnblogs.com/xihuankanyu/p/3447368.html

你可能感兴趣的文章
Palindrome Partitioning
查看>>
Leetcode: Binary Tree Inorder Traversal
查看>>
sessionStorage、localStorage与cookie
查看>>
3ds max 转换文件格式插件开发
查看>>
PHP变量作用域以及地址引用问题
查看>>
实验四
查看>>
网站迁移时候,发现<head>内容都到body里了
查看>>
前端开发实现自动化编译与部署
查看>>
3W法则-学习Docker
查看>>
Elastic Stack-Elasticsearch使用介绍(三)
查看>>
MacOS copy图标shell脚本
查看>>
linux 性能分析工具整理
查看>>
关于在Servelet中如何获取当前时间的操作
查看>>
怎么打包谷歌商店安装的文件?
查看>>
C陷阱与缺陷--读书笔记7 可移植性缺陷
查看>>
【索引】gtest学习笔记
查看>>
vue-随笔-transition
查看>>
第八章 方法
查看>>
【资源下载】Ext4.1.0_Doc中文版_V1.0.0_Beta正式提供下载!
查看>>
ThinkPHP 3.2.3 数据缓存与静态缓存
查看>>