mysql更改目录后,启动报错

现象1

[ERROR] InnoDB: auto-extending data file /export/servers/mysql56/data/ibdata1 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 65536 pages, max 0 (relevant if non-zero) pages!
2018-11-20 03:12:05 4434 [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!
2018-11-20 03:12:05 4434 [ERROR] Plugin 'InnoDB' init function returned error.
2018-11-20 03:12:05 4434 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-11-20 03:12:05 4434 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-11-20 03:12:05 4434 [ERROR] Aborting

解决方案:

解决方案:在/etc/my.cnf 中修改或增加 innodb_data_file_path=ibdata1:12M:autoextend  计算方式:768页*16K/页 / 1024K/M = 12M

 

现象2

 mysql.user table is damaged. Please run mysql_upgrade.
解决方案:

删除data 目录下的所有东西,使用 mysqld --initialize --user=mysql 命令初始化系统,保证系统能正常启动。
   

 

现象3
  mysql登录及密码修改
   出现 error: 'Access denied for user 'root'@'localhost' (using password: YES)' 提示不能正常登录

 

解决方案:

   安全启动mysql


mysqld_safe --user=mysql --skip-grant-tables --skip-networking &


mysql


mysql> update user set authentication_string=PASSWORD('root') where user='root';
Query OK, 1 row affected, 1 warning (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 1




mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
修改成功


重新启动mysql也成功


mysql登录后,提示修改密码


mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set PASSWORD=Password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> alter user root@localhost PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)




mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)


密码修改成功,密码也不提示过期了。   
   

参考链接

https://blog.csdn.net/tone19831223/article/details/77883138

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值