Chinaunix首页 | 论坛 | 博客
  • 博客访问: 79649
  • 博文数量: 27
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 246
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-26 10:22
个人简介

做个辛勤的搬运工

文章分类

全部博文(27)

文章存档

2015年(27)

我的朋友

分类: Mysql/postgreSQL

2015-01-15 10:51:02

安装完mysql 后,启动成功,但后面添加了/etc/my.cnf文件后,启动一直提示:
[root@localhost mysql]# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/mysqld.pid).

检查日志文件,发下如下内容:
130909  2:53:30 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
/usr/sbin/mysqld: File '/var/log/mysql/mysql-bin.index' not found (Errcode: 2)


检查/var/log/下没有mysql目录及下面的文件,于是手工创建一个.
[root@localhost log]# mkdir mysql
[root@localhost log]# cd mysql
[root@localhost mysql]# vi mysql-bin.idex


创建完成后,启动,报一样的错,查看日志


130909  2:58:41 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
/usr/sbin/mysqld: File '/var/log/mysql/mysql-bin.index' not found (Errcode: 13)


Errcode:13  这个错误跟权限有关,检查刚创建的文件,咳咳..root权限...
刚创建完成后,忘了授权.失误..立马授权


授权
[root@localhost log]# chown mysql:root mysql
[root@localhost log]# ls -l
drwxr-xr-x  2 mysql root   4096 9?  9 02:58 mysql


检查文件下文件权限
[root@localhost mysql]# ls -l
总用量 0
-rw-r--r-- 1 mysql root 0 9?  9 02:58 mysql-bin.idex


再启动
[root@localhost log]# service mysql start
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/mysqld.pid).

依然报错...靠..在检查日志..

[ERROR] /usr/sbin/mysqld: unknown variable 'default-character-set=utf8'


网上查了下,用character_set_server=utf8 来替换'default-character-set=utf8'

vi /etc/my.cnf

然后再启动..

[root@localhost log]# service mysql start
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/mysqld.pid).

查看日志:
130909  3:03:20 [ERROR] Plugin 'InnoDB' init function returned error.
130909  3:03:20 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130909  3:03:20 [ERROR] Unknown/unsupported storage engine: InnoDB
130909  3:03:20 [ERROR] Aborting

知道了,因为my.cnf文件里面有设置InnoDB引擎,但安装时,默认 是myisam,所以日志文件有影响.解决方法:
删除:cd /var/lib/mysql/文件夹下的ib_logfile0  ib_logfile1 两个日志文件,
然后启动.....

[root@localhost log]# cd /var/lib/mysql/
[root@localhost mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  localhost.localdomain.err  mysql  performance_schema  RPM_UPGRADE_HISTORY  RPM_UPGRADE_MARKER-LAST  test
[root@localhost mysql]# rm ib_logfile0
rm:是否删除普通文件 "ib_logfile0"?y
[root@localhost mysql]# rm ib_logfile1 
rm:是否删除普通文件 "ib_logfile1"?y
[root@localhost mysql]# ls
ibdata1  localhost.localdomain.err  mysql  performance_schema  RPM_UPGRADE_HISTORY  RPM_UPGRADE_MARKER-LAST  test
[root@localhost mysql]# service mysql start

报错日志:
140530  9:00:23 InnoDB: Initializing buffer pool, size = 2.0G
140530  9:00:24 InnoDB: Completed initialization of buffer pool
InnoDB: Error: data file ./ibdata1 is of a different size
InnoDB: 1152 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 960 pages!
140530  9:00:24 InnoDB: Could not open or create data files.
140530  9:00:24 InnoDB: If you tried to add new data files, and it failed here,
140530  9:00:24 InnoDB: you should now edit innodb_data_file_path in my.cnf back


在配置my.cnf的时候,内存改小了..所以ibdata1也需要该小
修改my.cnf里面innodb_data_file_path = ibdata1:500M;ibdata2:500M:autoextend
根据 1152/64=18
修改成:
innodb_data_file_path = ibdata1:18M;ibdata2:500M:autoextend

然后重启...ok
[root@localhost mysql]# service mysql start
Starting MySQL....... SUCCESS! 



这是一次对mysql不熟悉的时候的操作,所以日志的理解很重要,很多人一直出问题就找不到北,先看看日志吧.一般的错误,日志都是有详细说明的,根据日志报出的问题,在去寻找相应的解决方法


阅读(1789) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~