MySQL 启动报错Table 'mysql.plugin' doesn't exis(转载)

安装完成后,按照网上说启动mysql时却报了以下错误:

[root@localhost bin]# ./mysqld

2015-10-23 16:54:55 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-10-23 16:54:55 0 [Note] ./mysqld (mysqld 5.6.27) starting as process 31176 ...

2015-10-23 16:54:55 31176 [Warning] Can't create test file /data/mysql/localhost.lower-test

2015-10-23 16:54:55 31176 [Warning] Can't create test file /data/mysql/localhost.lower-test

./mysqld: Can't change dir to '/data/mysql/' (Errcode: 2 - No such file or directory)

2015-10-23 16:54:55 31176 [ERROR] Aborting

2015-10-23 16:54:55 31176 [Note] Binlog end

2015-10-23 16:54:55 31176 [Note] ./mysqld: Shutdown complete

网上的解决方法有很多,有些我试过不管用,但不能就说这些不管用的文章是乱写的,因为有些问题并不是由一个原因而引起的,不过可以试试,我对mysql了解不多,所以也不加以评论,我是使用以下方法解决的:

首先这个报错,很明显是由于找不到datadir目录/data/mysql/所引起的,其实我安装mysql时候是指定了datadir=/usr/mysqldata,于是我在usr创建了mysqldata目录:

[root@localhost usr]# mkdir -p /usr/mysqldata/

[root@localhost usr]# ls

[root@localhost usr]# chown -R mysql mysqldata

[root@localhost usr]# chgrp -R mysql mysqldata

然后再启动,不过仍然报错:

[root@localhost bin]# ./mysqld

2015-10-23 17:06:33 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-10-23 17:06:33 0 [Note] ./mysqld (mysqld 5.6.27) starting as process 31312 ...

2015-10-23 17:06:33 31312 [Note] Plugin 'FEDERATED' is disabled.

./mysqld: Table 'mysql.plugin' doesn't exist

2015-10-23 17:06:33 31312 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

2015-10-23 17:06:33 31312 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-10-23 17:06:33 31312 [Note] InnoDB: The InnoDB memory heap is disabled

2015-10-23 17:06:33 31312 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-10-23 17:06:33 31312 [Note] InnoDB: Memory barrier is not used

2015-10-23 17:06:33 31312 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-10-23 17:06:33 31312 [Note] InnoDB: Using CPU crc32 instructions

2015-10-23 17:06:33 31312 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-10-23 17:06:33 31312 [Note] InnoDB: Completed initialization of buffer pool

2015-10-23 17:06:33 31312 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2015-10-23 17:06:33 31312 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2015-10-23 17:06:33 31312 [Note] InnoDB: Database physically writes the file full: wait...

2015-10-23 17:06:33 31312 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2015-10-23 17:06:34 31312 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2015-10-23 17:06:34 31312 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2015-10-23 17:06:34 31312 [Warning] InnoDB: New log files created, LSN=45781

2015-10-23 17:06:34 31312 [Note] InnoDB: Doublewrite buffer not found: creating new

2015-10-23 17:06:34 31312 [Note] InnoDB: Doublewrite buffer created

2015-10-23 17:06:34 31312 [Note] InnoDB: 128 rollback segment(s) are active.

2015-10-23 17:06:34 31312 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-10-23 17:06:34 31312 [Note] InnoDB: Foreign key constraint system tables created

2015-10-23 17:06:34 31312 [Note] InnoDB: Creating tablespace and datafile system tables.

2015-10-23 17:06:34 31312 [Note] InnoDB: Tablespace and datafile system tables created.

2015-10-23 17:06:34 31312 [Note] InnoDB: Waiting for purge to start

2015-10-23 17:06:34 31312 [Note] InnoDB: 5.6.27 started; log sequence number 0

2015-10-23 17:06:34 31312 [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: 5bed1721-7965-11e5-a520-000c299a432a.

2015-10-23 17:06:34 31312 [Note] Server hostname (bind-address): '*'; port: 3306

2015-10-23 17:06:34 31312 [Note] IPv6 is available.

2015-10-23 17:06:34 31312 [Note]   - '::' resolves to '::';

2015-10-23 17:06:34 31312 [Note] Server socket created on IP: '::'.

2015-10-23 17:06:34 31312 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

从报错上来看,是由于缺少了mysql.plugin表所致的,不过现在连启动都启动不了,怎样创建表呢?所以肯定是其他原因导致的,于时继续网上找继续试,最后找到了这个处理方法,进入mysql安装后的目录scripts执行以下语句:

[root@localhost scripts]# ./mysql_install_db --user=mysql --basedir=/home/mysql5627 --datadir=/usr/mysqldata

Installing MySQL system tables...2015-10-23 17:47:57 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-10-23 17:47:57 0 [Note] /home/mysql5627/bin/mysqld (mysqld 5.6.27) starting as process 31756 ...

2015-10-23 17:47:57 31756 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-10-23 17:47:57 31756 [Note] InnoDB: The InnoDB memory heap is disabled

2015-10-23 17:47:57 31756 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-10-23 17:47:57 31756 [Note] InnoDB: Memory barrier is not used

2015-10-23 17:47:57 31756 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-10-23 17:47:57 31756 [Note] InnoDB: Using CPU crc32 instructions

2015-10-23 17:47:57 31756 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-10-23 17:47:57 31756 [Note] InnoDB: Completed initialization of buffer pool

2015-10-23 17:47:57 31756 [Note] InnoDB: Highest supported file format is Barracuda.

2015-10-23 17:47:57 31756 [Note] InnoDB: Log scan progressed past the checkpoint lsn 49463

2015-10-23 17:47:57 31756 [Note] InnoDB: Database was not shutdown normally!

2015-10-23 17:47:57 31756 [Note] InnoDB: Starting crash recovery.

2015-10-23 17:47:57 31756 [Note] InnoDB: Reading tablespace information from the .ibd files...

2015-10-23 17:47:57 31756 [Note] InnoDB: Restoring possible half-written data pages 

2015-10-23 17:47:57 31756 [Note] InnoDB: from the doublewrite buffer...

InnoDB: Doing recovery: scanned up to log sequence number 1600607

2015-10-23 17:47:57 31756 [Note] InnoDB: Starting an apply batch of log records to the database...

InnoDB: Progress in percent: 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

2015-10-23 17:47:58 31756 [Note] InnoDB: 128 rollback segment(s) are active.

2015-10-23 17:47:58 31756 [Note] InnoDB: Waiting for purge to start

2015-10-23 17:47:58 31756 [Note] InnoDB: 5.6.27 started; log sequence number 1600607

2015-10-23 17:47:58 31756 [Note] Binlog end

2015-10-23 17:47:58 31756 [Note] InnoDB: FTS optimize thread exiting.

2015-10-23 17:47:58 31756 [Note] InnoDB: Starting shutdown...

2015-10-23 17:48:00 31756 [Note] InnoDB: Shutdown completed; log sequence number 1625987

OK

Filling help tables...2015-10-23 17:48:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-10-23 17:48:00 0 [Note] /home/mysql5627/bin/mysqld (mysqld 5.6.27) starting as process 31780 ...

2015-10-23 17:48:00 31780 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-10-23 17:48:00 31780 [Note] InnoDB: The InnoDB memory heap is disabled

2015-10-23 17:48:00 31780 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-10-23 17:48:00 31780 [Note] InnoDB: Memory barrier is not used

2015-10-23 17:48:00 31780 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-10-23 17:48:00 31780 [Note] InnoDB: Using CPU crc32 instructions

2015-10-23 17:48:00 31780 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-10-23 17:48:00 31780 [Note] InnoDB: Completed initialization of buffer pool

2015-10-23 17:48:00 31780 [Note] InnoDB: Highest supported file format is Barracuda.

2015-10-23 17:48:00 31780 [Note] InnoDB: 128 rollback segment(s) are active.

2015-10-23 17:48:00 31780 [Note] InnoDB: Waiting for purge to start

2015-10-23 17:48:00 31780 [Note] InnoDB: 5.6.27 started; log sequence number 1625987

2015-10-23 17:48:00 31780 [Note] Binlog end

2015-10-23 17:48:00 31780 [Note] InnoDB: FTS optimize thread exiting.

2015-10-23 17:48:00 31780 [Note] InnoDB: Starting shutdown...

2015-10-23 17:48:01 31780 [Note] InnoDB: Shutdown completed; log sequence number 1625997

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:

  /home/mysql5627/bin/mysqladmin -u root password 'new-password'

  /home/mysql5627/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

  /home/mysql5627/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 . ; /home/mysql5627/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 at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /home/mysql5627/my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as /home/mysql5627/my-new.cnf,

please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

然后再运行./mysqld就成功了。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,905评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,140评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,791评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,483评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,476评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,516评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,905评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,560评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,778评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,557评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,635评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,338评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,925评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,898评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,142评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,818评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,347评论 2 342

推荐阅读更多精彩内容