Centos6.9下 yum 安装 lnmp遇到的几个问题总结

一、mysql无法启动

InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages! 

问题描述:

  centos 安装MySQL

  $yum install mysql-server
  安装之后执行命令mysql

  报错:

查看mysql的启动日志:

[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2016-02-22 23:02:55 29830 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2016-02-22 23:02:55 29830 [ERROR] Plugin 'InnoDB' init function returned error.
2016-02-22 23:02:55 29830 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-02-22 23:02:55 29830 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-02-22 23:02:55 29830 [ERROR] Aborting

解决方法:

 执行删除命令:rm -rf /var/lib/mysql/ib*

删除:ibdata1、ib_logfile0、ib_logfile1文件

重新启动:service mysqld start

二、mysql 重置密码报错

错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

一般这个错误是由密码错误引起,解决的办法自然就是重置密码。

假设我们使用的是root账户。

1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下:

#vim /etc/my.cnf(注:windows下修改的是my.ini)

在文档内搜索mysqld定位到[mysqld]文本段:
/mysqld(在vim编辑状态下直接输入该命令可搜索文本内容)

在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程,如下图所示:

保存文档并退出:

#:wq
2.接下来我们需要重启MySQL:

/etc/init.d/mysql restart(有些用户可能需要使用/etc/init.d/mysqld restart)

3.重启之后输入#mysql即可进入mysql。

4.接下来就是用sql来修改root的密码

mysql> use mysql;
mysql> update user set password=password("你的新密码") where user="root";
mysql> flush privileges;
mysql> quit

到这里root账户就已经重置成新的密码了。

5.编辑my.cnf,去掉刚才添加的内容,然后重启MySQL。大功告成!

三、NGINX 无法启动

nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

解决办法:

vim /etc/nginx/conf.d/default.conf

listen       80 default_server;
listen       [::]:80 default_server;


改为:
listen       80;

#listen       [::]:80 default_server;

重新启动nginx即可,网上说的那种kill掉nginx进程和ipv6 on的方法不适用

猜你喜欢

转载自blog.csdn.net/weixin_40283570/article/details/81477390
今日推荐