Errors when installing MySQL on windows

Windows下安装MySQL的时候,在用“MySQLInstanceConfig.exe”来配置一个新的instance的时候老是在启动MySQL windows服务的时候挂掉,后来在Windows的Event Viewer中看到如下错误...

"Plugin 'InnoDB' registration as a STORAGE ENGINE failed" 

网上搜了下,有人提到删除目录下的ib_logfile0和ib_logfile1文件。但是奈何不知道这两个文件放在什么地方,用"Everything.exe"搜索了下,终于发现文件所在什么地方...


诡异的是发现很多目录的创建时期是在去年,突然想起以前这个机器上装过MySQL,不过没用过后来删除了!同时注意到有个.err文件,打开一看,发现所有的错误信息都详细记录着....

120301 22:47:51 [Note] Plugin 'FEDERATED' is disabled.
120301 22:47:51 InnoDB: The InnoDB memory heap is disabled
120301 22:47:51 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120301 22:47:51 InnoDB: Compressed tables use zlib 1.2.3
120301 22:47:51 InnoDB: Initializing buffer pool, size = 47.0M
120301 22:47:52 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file .\ib_logfile0 is of different size 0 10485760 bytes
InnoDB: than specified in the .cnf file 0 25165824 bytes!
120301 22:47:52 [ERROR] Plugin 'InnoDB' init function returned error.
120301 22:47:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120301 22:47:52 [ERROR] Unknown/unsupported storage engine: INNODB
120301 22:47:52 [ERROR] Aborting


注意到其中关于ib_logfile0文件大小不匹配的问题,看来真的需要删除重新生成才行。删除之后,重新进行操作...

120301 23:06:15 [Note] Plugin 'FEDERATED' is disabled.
120301 23:06:15 InnoDB: The InnoDB memory heap is disabled
120301 23:06:15 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120301 23:06:15 InnoDB: Compressed tables use zlib 1.2.3
120301 23:06:15 InnoDB: Initializing buffer pool, size = 47.0M
120301 23:06:15 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file E:\MySQL Datafiles\ibdata1 did not exist:
InnoDB: a new database to be created!
120301 23:06:15 InnoDB: Setting file E:\MySQL Datafiles\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
120301 23:06:15 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 24 MB
InnoDB: Database physically writes the file full: wait...
120301 23:06:16 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 24 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
120301 23:06:17 InnoDB: Waiting for the background threads to start
120301 23:06:18 InnoDB: 1.1.5 started; log sequence number 0
120301 23:06:19 [Note] Event Scheduler: Loaded 0 events
120301 23:06:19 [Note] C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld: ready for connections.
Version: '5.5.10' socket: '' port: 3306 MySQL Community Server (GPL)


从信息中看到ib_logfile0和ib_logfile1都重新创建了。而且可以看出MySQL对InnoDB做了写初始化工作...

(1)Create doublewrite buffer

(2) Create rollback segments

(3) Create FK constraint system tables

但是,但是,故事还没有结束....

接下来碰到一个更加诡异的问题,在配置Instance最后一步“apply security setting"的时候老是不成功,总是报”Can't connect to mysql server on ‘localhost’(10060)“ 这个错误,无论是换端口号,重新配置instance,重装mysql,最后还是死在这个地方。如果选择skip这个步骤的话,在开始菜单里面选择”MySql Command Line Client"的时候,在输入password之后就会报错退出了!

如果在command line下输入 mysql -u root -p的话,输入password之后也会报错!

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


真是崩溃!在绝望的时候,试了一下 mysql -u root, 没有加-p选项,居然成功连上了!

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


后来在网上搜了下,有人指出可能需要进行下授权可以解决上面遇到的问题...

GRANT ALL PRIVILEGES ON %s.* TO '%s'@'localhost' IDENTIFIED BY '%s


mysql> GRANT ALL PRIVILEGES ON mysql.* TO 'root'@'localhost' IDENTIFIED BY 'root'
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> Bye
Ctrl-C -- exit!

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


然后就没有然后了~



原文地址:https://www.cnblogs.com/fangwenyu/p/2376412.html