/usr/sbin/mysqld: error while loading shared libraries: libprotobuf-lite.so.3.19.4: cannot open shared object file: No such file or directory
天翼云上面的服务器是Ubuntu20.04,因为设备配置变更,客服变更后密码莫名不对了,实在无奈强制关机后改了密码.
再次启动服务器后,发现自动启动的服务没有启动.检查进程发现mysql没有启动,对应的平台进程也没有启动.
那么发现是mysql没有启动造成的,先去/var/log/syslog里面找一下 日志.
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 systemd[1]: mysql.service: Main process exited, code=exited, status=127/n/a
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 systemd[1]: mysql.service: Failed with result ‘exit-code’.
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 systemd[1]: Failed to start MySQL Community Server.
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 4.
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 systemd[1]: Stopped MySQL Community Server.
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 systemd[1]: Starting MySQL Community Server…
Feb 24 03:01:08 master-yzjgxh2578346419-1667378623792 mysqld[2846]: /usr/sbin/mysqld: error while loading shared libraries: libprotobuf-lite.so.3.19.4: cannot open shared object file: No such file or directory
发现无法加载libprotobuf-lite.so.3.19.4.
遂定位到/usr/lib/mysql/private/目录发现文件有,但是没有权限.
授权之,启动mysql发现还是无法启动,还是报相同错误.
无意中发现/usr/lib/mysql 没有权限,chmod -R 777 /usr/lib/mysql
提示
root@master-yzjgxh2578346419-1667378623792:/usr/lib# chmod -R 777 mysql
chmod: changing permissions of ‘mysql/plugin’: Operation not permitted
chmod: changing permissions of ‘mysql/zlib_decompress’: Operation not permitted
chmod: changing permissions of ‘mysql/private’: Operation not permitted
先解决这个权限问题吧 需要用到chmod的底层命令
lsattr /usr/lib/mysql/
结果
root@master-yzjgxh2578346419-1667378623792:/usr/lib# lsattr /usr/lib/mysql/
----i---------e----- /usr/lib/mysql/plugin
----i---------e----- /usr/lib/mysql/zlib_decompress
----i---------e----- /usr/lib/mysql/private
说明文件夹被锁了
执行chattr -i /usr/lib/mysql/
再chmod -R 777 /usr/lib/mysql 权限只是没时间去搞了全开放吧
启动mysql 还报相同错误, 怎么办?
后面想到这是64位系统, cp /usr/lib/mysql /usr/lib64/mysql
再次启动mysql .成功了.
记录一下便于下次用,也供大家借鉴.