首页 > 数据库 >linux 启动mysql失败 InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are

linux 启动mysql失败 InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are

时间:2022-09-24 10:34:23浏览次数:73  
标签:11 ibdata1 centos VM flags mysql Table root mysqld

linux 启动mysql失败,

报错日志文件里的报错信息 InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!

执行 sudo systemctl start mysqld.service     #启动服务

执行 命令后的报错信息 Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.   排查思路: 1.先查看日志文件. 2.在日志中找到最新的日志信息,并找到关键报错信息. 3.先自己想,如果不会上网找方法,方法有很多,但不一定和你的情况一样,要找到情况一样的解决方法   开始处理: 1.查看日志文件
[root@VM-4-11-centos lib]# find / -name mysqld.log #不知道日志文件在哪的命令
/var/log/mysqld.log 
[root@VM-4-11-centos lib]# cat /var/log/mysqld.log |grep "2022-09-24" #这个命令是查看当天的错误日志,日志文件时的信息很多,要看最先的

关键报错信息:

 看到这个报错信息我一开始是看不懂是什么意思的,所以上网百度了这个: InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!

到了一个和我情况一样的文章.

https://www.jianshu.com/p/7af95b08b954?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

文章里说:

InnoDB的问题。原来安装的是mysql8.0版本,比现在的5.7版本要高,但在高版本数据库时创建的一些数据库数据都还在,使用的是高版本的InnoDB引擎,而低版本的数据库服务还是指向了这些数据,但是一些版本的数据格式不同,这个时候,我们只要把高版本的数据删掉就可以了,删掉后重新启动mysql就可以了。   删除高版本数据库时创建的数据,不是仅仅删除创建的一些数据库,而是把整个mysql的数据目录全部删除。

 

[root@VM-4-11-centos sbin]# cd /var/lib/mysql
[root@VM-4-11-centos mysql]# ls
[root@VM-4-11-centos lib]# ls
alternatives  cloud     games      logrotate  mlocate      mysql-keyring   ntp        polkit-1  rpm-state  systemd
authconfig    dbus      initramfs  machines   mysql        NetworkManager  os-prober  postfix   rsyslog    tuned
chrony        dhclient  iscsi      misc       mysql-files  nginx           plymouth   rpm       stateless  yum

[root@VM-4-11-centos mysql]# cd ..
[root@VM-4-11-centos lib]# rm -rf mysql #删除文件和文件夹命令
[root@VM-4-11-centos lib]# ls
alternatives  chrony  dbus      games      iscsi      machines  mlocate      mysql-keyring   nginx  os-prober  polkit-1  rpm        rsyslog    systemd  yum
authconfig    cloud   dhclient  initramfs  logrotate  misc      mysql-files  NetworkManager  ntp    plymouth   postfix   rpm-state  stateless  tuned

在最后一个ls命令打印的信息里没有看 mysql 文件夹了,说明删除成功.

接下来是启动mysql服务

[root@VM-4-11-centos lib]# sudo systemctl start mysqld.service #启动mysql服务
[root@VM-4-11-centos lib]# netstat -tunlpg | grep mysql #查看mysql端口
tcp6       0      0 :::3306                 :::*                    LISTEN      15984/mysqld   
看到3306端口就说明启动成功了.

 

 

 

标签:11,ibdata1,centos,VM,flags,mysql,Table,root,mysqld
From: https://www.cnblogs.com/stevenchen2016/p/16724975.html

相关文章