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

[root@nn ~]# tail -n 20 /var/log/mysqld.log
130924 10:14:54 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
130924 10:14:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
130924 10:27:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
130924 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.0M
130924 10:27:09 InnoDB: Completed initialization of buffer pool
InnoDB: Log scan progressed past the checkpoint lsn 0 37356
130924 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 doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 0 44233
130924 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 99
InnoDB: Apply batch completed
130924 10:27:10 InnoDB: Started; log sequence number 0 44233
130924 10:27:10 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
130924 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...
OK
Filling help tables...
OK To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system PLEASE 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_installation which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly 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.pl
cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [root@nn ~]#
[root@nn ~]# service mysqld start
Starting mysqld: [ OK ]

mysql提示Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist解决方法的更多相关文章

  1. [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

    mysql 启动总是报错: 错误日志中显示: [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' ...

  2. [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 160913 02:11:21 mysqld_safe mysqld from pid file /tmp/mysql.pid ended

    -- :: [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 -- :: [Warning] InnoDB: New ...

  3. mysql [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist (转载)

    mysql报错Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 2013-11-2 ...

  4. Mysql报错Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

    安装mysql后,启动时候没有启动成功,查看了下日志报错如下:---------------------------------------------1   可以:初始化mysql:mysql_in ...

  5. Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

    今天在用一键安装mysql的shell脚本安装mysql-5.1.73软件后发现mysql始终无法启动,多次执行后依旧报错,只能去查看error日志,发现了如下的2个错误: 错误一:Fatal err ...

  6. 【转】安装mysql 出现:Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

    来源:http://blog.csdn.net/dapeng0112/article/details/37053407 本来初始化配置是这样的: scripts/mysql_install_db -- ...

  7. mysql启动报错:Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist

    mysql在首次启动的时候可能会报错:Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist 这时候可以执行脚本 ...

  8. [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

    这个问题是由于data的目录下没有安装数据库表 解决方法: vi /etc/my.cnf 修改为正确的datadir=“xxxxx”即可 然后service mysqld start service ...

  9. mysql安转过程中出现的问题! Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exis

    net start mysql启动失败,报错信息如上,因缺少mysql这个库 所以跳过 在my.ini中添加 --skip-grant-tables 再启动mysql 然后进入mysql 倒入一个从其 ...

随机推荐

  1. Python+Selenium笔记(二):配置谷歌+IE环境

    #有的时候可能要访问外国的网站下载资料或工具,这时可能出现各种问题,例如谷歌人机验证显示不了.网站打不开等,建议使用一个FQ软件 (一)  设置IE (1)   http://docs.seleniu ...

  2. 字节顺序标记BOM

    最近,从numbers导出的csv文件,导入excel后,出现中文乱码问题.网上查询后,发现是numbers导出的csv默认是utf-8无BOM的,使用sublimText3打开,另存为utf-8wi ...

  3. SQL Server自动备份 备份到本地或者远程服务器

    0.1 在SQLServer2008 --> 备份数据库 --> 安全 --> 新建用户 --> 用户名 选择该windows用户 (确保 --> 机器名/人名 --&g ...

  4. SpringMVC_JDBC

    链接:https://pan.baidu.com/s/1a8Aht1eIeRYGb78X9v3ubA 密码:h2zy 未完,待续...

  5. python下以api形式调用tesseract识别图片验证码

    一.背景 之前在博文中介绍在python中如何调用tesseract ocr引擎,当时主要介绍了shell模式,shell模式需要安装tesseract程序,并且效率相对略低. 今天介绍api形式的调 ...

  6. python使用mechanize模拟登陆新浪邮箱

    mechanize相关知识准备: mechanize.Browser()<br># 设置是否处理HTML http-equiv标头 set_handle_equiv(True)<br ...

  7. 使用C#获取Windows Phone手机的各种数据(转)

    转自:http://www.sum16.com/desinger/use-c-sharp-get-windows-phone-information.html 使用C#获取Windows Phone手 ...

  8. AnyHashable类型擦除的原因:set和dictory需要指定一个确定的类型

    AnyHashable 属于无关联类型的擦除. 将具体类型的类型信息擦除掉了,只剩下协议类型的信息暴露出来. 类型擦除实践:将相同协议的不同实现屏蔽起来,暴露出类型的共同特征(协议接口). A typ ...

  9. 怎样自适应ios设备大小

       在编写移动端GIS程序的时候.常常要依据ios设备的大小来设置UI.曾经我在ios程序中,须要定义设备的值(如:宽度和高度),如: 可是假设是不同的设备.如iphone4.iphone5,甚至是 ...

  10. Docker技术入门与实战 第二版-学习笔记-6-仓库

    仓库(Repository)是集中存放镜像的地方 一个容易混淆的概念是注册服务器(Registry). 实际上注册服务器是管理仓库的具体服务器,每个服务器上可以有多个仓库,而每个仓库下面有多个镜像. ...