MySQL Study之--Mysql启动失败“mysql.host”

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

系统环境

操作系统:RedHat EL55

DB Soft:  Mysql 5.6.4-m7


通过源码包安装mysql后,在启动mysqld时出现错误:

[root@rh55 mysql]# bin/mysqld_safe &
[1] 15846
[root@rh55 mysql]# 150610 17:04:36 mysqld_safe Logging to '/usr/local/mysql/data/mysql/rh55.err'.
150610 17:04:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql
150610 17:04:37 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/rh55.pid ended

[1]+  Done                    bin/mysqld_safe


查看mysql日志:


[root@rh55 mysql]# more /usr/local/mysql/data/mysql/rh55.err

  1. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    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
    150610 16:56:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql  
    /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist  
    150610 16:57:00 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.  
    150610 16:57:00 InnoDB: The InnoDB memory heap is disabled  
    150610 16:57:00 InnoDB: Mutexes and rw_locks use InnoDB's own implementation  
    150610 16:57:00 InnoDB: Compressed tables use zlib 1.2.3  
    150610 16:57:00 InnoDB: CPU does not support crc32 instructions  
    150610 16:57:00 InnoDB: Initializing buffer pool, size = 128.0M  
    150610 16:57:00 InnoDB: Completed initialization of buffer pool  
    InnoDB: The first specified data file ./ibdata1 did not exist:  
    InnoDB: a new database to be created!  
    150610 16:57:00 InnoDB: Setting file ./ibdata1 size to 10 MB  
    InnoDB: Database physically writes the file full: wait...  
    150610 16:57:01 InnoDB: Log file ./ib_logfile0 did not exist: new to be created  
    InnoDB: Setting log file ./ib_logfile0 size to 5 MB  
    InnoDB: Database physically writes the file full: wait...  
    150610 16:57:02 InnoDB: Log file ./ib_logfile1 did not exist: new to be created  
    InnoDB: Setting log file ./ib_logfile1 size to 5 MB  
    InnoDB: Database physically writes the file full: wait...  
    InnoDB: Doublewrite buffer not found: creating new  
    InnoDB: Doublewrite buffer created  
    150610 16:57:04 InnoDB: 128 rollback segment(s) are active.  
    InnoDB: Creating foreign key constraint system tables  
    InnoDB: Foreign key constraint system tables created  
    150610 16:57:04 InnoDB: Waiting for the background threads to start  
    150610 16:57:05 InnoDB: 1.2.4 started; log sequence number 0  
    150610 16:57:05 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been  
      started. Generating a new UUID: ab19e2d2-0f4e-11e5-b157-080027973e8a.  
    150610 16:57:05 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist  
    150610 16:57:05 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/rh55.pid ended  
    150610 17:04:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql  
    /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist  
    150610 17:04:36 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.  
    150610 17:04:36 InnoDB: The InnoDB memory heap is disabled  
    150610 17:04:36 InnoDB: Mutexes and rw_locks use InnoDB's own implementation  
    150610 17:04:36 InnoDB: Compressed tables use zlib 1.2.3  
    150610 17:04:36 InnoDB: CPU does not support crc32 instructions  
    150610 17:04:36 InnoDB: Initializing buffer pool, size = 128.0M  
    150610 17:04:36 InnoDB: Completed initialization of buffer pool  
    150610 17:04:36 InnoDB: highest supported file format is Barracuda.  
    InnoDB: Log scan progressed past the checkpoint lsn 48961  
    150610 17:04:36  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 1595695  
    150610 17:04:36  InnoDB: Starting an apply batch of log records to the database...  
    InnoDB: Progress in percents: 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  
    150610 17:04:37 InnoDB: 128 rollback segment(s) are active.  
    150610 17:04:37 InnoDB: 1.2.4 started; log sequence number 1595695  
    150610 17:04:37 [Note] Recovering after a crash using mysql-bin  
    150610 17:04:37 [Note] Starting crash recovery...  
    150610 17:04:37 [Note] Crash recovery finished.  
    150610 17:04:37 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist  
    150610 17:04:37 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/rh55.pid ended

查看mysql配置文件:
[root@rh55 ~]# cat /etc/my.cnf

1
2
3
4
5
6
7
8
9
10
11
12
13
[mysqld]  
port            =  3306  
socket          = /tmp/mysql.sock  
skip-external-locking  
key_buffer_size = 16M  
max_allowed_packet = 1M  
table_open_cache =  64  
sort_buffer_size = 512K  
net_buffer_length = 8K  
read_buffer_size = 256K  
read_rnd_buffer_size = 512K  
myisam_sort_buffer_size = 8M  
datadir=/usr/local/mysql/data/mysql

解决方案:
[root@rh55 mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql

  1. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    WARNING: The host  'rh55'  could not be looked up with resolveip.  
    This probably means that your libc libraries are not  100  % compatible  
    with  this  binary MySQL version. The MySQL daemon, mysqld, should work  
    normally with the exception that host name resolving will not work.  
    This means that you should use IP addresses instead of hostnames  
    when specifying MySQL privileges !  
    Installing MySQL system tables...  
    150610  17 : 07 : 10  InnoDB: The InnoDB memory heap is disabled  
    150610  17 : 07 : 10  InnoDB: Mutexes and rw_locks use InnoDB's own implementation  
    150610  17 : 07 : 10  InnoDB: Compressed tables use zlib  1.2 . 3  
    150610  17 : 07 : 10  InnoDB: CPU does not support crc32 instructions  
    150610  17 : 07 : 10  InnoDB: Initializing buffer pool, size =  128 .0M  
    150610  17 : 07 : 10  InnoDB: Completed initialization of buffer pool  
    150610  17 : 07 : 10  InnoDB: highest supported file format is Barracuda.  
    InnoDB: Log scan progressed past the checkpoint lsn  48961  
    150610  17 : 07 : 10   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  1595695  
    150610  17 : 07 : 11   InnoDB: Starting an apply batch of log records to the database...  
    InnoDB: Progress in percents:  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  
    150610  17 : 07 : 11  InnoDB:  128  rollback segment(s) are active.  
    150610  17 : 07 : 11  InnoDB: Waiting  for  the background threads to start  
    150610  17 : 07 : 12  InnoDB:  1.2 . 4  started; log sequence number  1595695  
    150610  17 : 07 : 12  [Note] Recovering after a crash using mysql-bin  
    150610  17 : 07 : 12  [Note] Starting crash recovery...  
    150610  17 : 07 : 12  [Note] Crash recovery finished.  
    150610  17 : 07 : 14  [Warning] Info table is not ready to be used. Table  'mysql.slave_master_info'  cannot be opened.  
    150610  17 : 07 : 14  [Warning] Error  while  checking replication metadata. Setting the requested repository in order to give users the chance to fix the problem and restart the server. If  this  is a live upgrade please consider using mysql_upgrade to fix the problem.  
    150610  17 : 07 : 14  [Warning] Info table is not ready to be used. Table  'mysql.slave_relay_log_info'  cannot be opened.  
    150610  17 : 07 : 14  [Warning] Error  while  checking replication metadata. Setting the requested repository in order to give users the chance to fix the problem and restart the server. If  this  is a live upgrade please consider using mysql_upgrade to fix the problem.  
    150610  17 : 07 : 15  [Note] Binlog end  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'partition'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_FOREIGN_COLS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_FOREIGN'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_FIELDS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_COLUMNS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_INDEXES'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_TABLESTATS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_SYS_TABLES'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_INDEX_TABLE'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_INDEX_CACHE'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_CONFIG'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_BEING_DELETED'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_DELETED'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_INSERTED'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_FT_DEFAULT_STOPWORD'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_METRICS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_BUFFER_POOL_STATS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_BUFFER_PAGE_LRU'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_BUFFER_PAGE'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_CMPMEM_RESET'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_CMPMEM'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_CMP_RESET'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_CMP'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_LOCK_WAITS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_LOCKS'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'INNODB_TRX'  
    150610  17 : 07 : 15  [Note] Shutting down plugin  'InnoDB'  
    150610  17 : 07 : 15   InnoDB: FTS optimize thread exiting.  
    150610  17 : 07 : 15   InnoDB: Starting shutdown...  
    150610  17 : 07 : 16  InnoDB: Shutdown completed; log sequence number  1602851  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'PERFORMANCE_SCHEMA'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'CSV'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'MRG_MYISAM'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'MEMORY'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'MyISAM'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'mysql_old_password'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'mysql_native_password'  
    150610  17 : 07 : 16  [Note] Shutting down plugin  'binlog'  
    OK  
    Filling help tables...  
    150610  17 : 07 : 16  InnoDB: The InnoDB memory heap is disabled  
    150610  17 : 07 : 16  InnoDB: Mutexes and rw_locks use InnoDB's own implementation  
    150610  17 : 07 : 16  InnoDB: Compressed tables use zlib  1.2 . 3  
    150610  17 : 07 : 16  InnoDB: CPU does not support crc32 instructions  
    150610  17 : 07 : 16  InnoDB: Initializing buffer pool, size =  128 .0M  
    150610  17 : 07 : 16  InnoDB: Completed initialization of buffer pool  
    150610  17 : 07 : 16  InnoDB: highest supported file format is Barracuda.  
    150610  17 : 07 : 17  InnoDB:  128  rollback segment(s) are active.  
    150610  17 : 07 : 17  InnoDB:  1.2 . 4  started; log sequence number  1602851  
    150610  17 : 07 : 17  [Note] Binlog end  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'partition'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_FOREIGN_COLS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_FOREIGN'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_FIELDS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_COLUMNS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_INDEXES'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_TABLESTATS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_SYS_TABLES'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_INDEX_TABLE'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_INDEX_CACHE'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_CONFIG'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_BEING_DELETED'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_DELETED'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_INSERTED'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_FT_DEFAULT_STOPWORD'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_METRICS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_BUFFER_POOL_STATS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_BUFFER_PAGE_LRU'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_BUFFER_PAGE'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_CMPMEM_RESET'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_CMPMEM'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_CMP_RESET'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_CMP'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_LOCK_WAITS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_LOCKS'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'INNODB_TRX'  
    150610  17 : 07 : 17  [Note] Shutting down plugin  'InnoDB'  
    150610  17 : 07 : 17   InnoDB: FTS optimize thread exiting.  
    150610  17 : 07 : 17   InnoDB: Starting shutdown...  
    150610  17 : 07 : 18  InnoDB: Shutdown completed; log sequence number  1602861  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'PERFORMANCE_SCHEMA'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'CSV'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'MRG_MYISAM'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'MEMORY'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'MyISAM'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'mysql_old_password'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'mysql_native_password'  
    150610  17 : 07 : 18  [Note] Shutting down plugin  'binlog'  
    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:  
       
    ./bin/mysqladmin -u root password  'new-password'  
    ./bin/mysqladmin -u root -h rh55 password  'new-password'  
       
    Alternatively you can run:  
    ./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 . ; ./bin/mysqld_safe &  
       
    You can test the MySQL daemon with mysql-test-run.pl  
    cd ./mysql-test ; perl mysql-test-run.pl  
       
    Please report any problems with the ./bin/mysqlbug script!


启动mysql server:

[root@rh55 mysql]# bin/mysqld_safe &
[1] 16199
[root@rh55 mysql]# 150610 17:08:22 mysqld_safe Logging to '/usr/local/mysql/data/mysql/rh55.err'.
150610 17:08:22 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql

验证启动成功:
[root@rh55 mysql]# netstat -an |grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN  










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1660556,如需转载请自行联系原作者
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
11月前
|
关系型数据库 MySQL Linux
MySQL 启动失败的常见原因---发表到爱可生开源社区
MySQL 启动失败的最常见的原因有两类,分别是无法访问系统资源和参数设置错误造成的,下面分别分析如下。
226 0
|
11月前
|
关系型数据库 MySQL
|
关系型数据库 MySQL 测试技术
mysql缺少binlog启动失败
因为磁盘满了,就直接把binlog都统统给删了(通常会留最后几个,因为直觉告诉我,都删了肯定有问题),今天没注意都给删了,然后起msyql时就起不来了。
244 0
mysql缺少binlog启动失败
|
关系型数据库 MySQL Linux
linux系统mysql服务启动失败
linux系统mysql服务启动失败
linux系统mysql服务启动失败
|
关系型数据库 MySQL PHP
MySQL - 如何查看 MySQL 服务启动失败具体问题
MySQL - 如何查看 MySQL 服务启动失败具体问题
213 0
MySQL - 如何查看 MySQL 服务启动失败具体问题
|
监控 关系型数据库 MySQL
阿里云CentOS 7.2 MySQL服务启动失败的解决思路
阿里云 CentOS 7.2 MySQL服务启动失败的解决思路 前言 : 昨天刚刚搭建好的MySQL让老大看了一下,经过测试已经完成任务。但是今天早晨来的时候发现服务器被关了,此时我的心情崩溃的,但是我非常冷静的解决了MySQL问题。
1347 0
|
关系型数据库 MySQL Linux
linux环境下 xampp mysql 启动失败问题排查 日志文件过大占用存储空间导致网站瘫痪
问题现象 网站莫名其妙的连接不上mysql了,导致网站瘫痪;没有改任何程序,怎么回事呢?马上用xshell 和xftp工具连接linux服务器来排查问题 启动xampp mysql /opt/lampp/lampp startmysql 启动xampp mysql ![/opt/lampp/bin/mysql.
2822 0
|
监控 关系型数据库 MySQL