opensuse upgrade 后 mariadb 启动失败

更新mariadb后启动不了

suse-tom:/usr/libexec/mysql # systemctl start mariadb    #启动失败
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xeu mariadb.service" for details.
suse-tom:/usr/libexec/mysql # systemctl status mariadb.service
suse-tom:~ # journalctl -u mariadb -b
Sep 05 22:19:00 suse-tom systemd[1]: Starting MariaDB database server...
Sep 05 22:19:01 suse-tom mysql-systemd-helper[1874]: Checking MySQL configuration for obsolete options...
Sep 05 22:19:01 suse-tom mysql-systemd-helper[1874]: Trying to run upgrade of MySQL databases...
Sep 05 22:19:01 suse-tom mysql-systemd-helper[1874]: Running protected MySQL...
Sep 05 22:19:01 suse-tom mysql-systemd-helper[1874]: Waiting for MySQL to start
Sep 05 22:19:01 suse-tom mysql-systemd-helper[1894]: 2022-09-05 22:19:01 0 [Note] /usr/sbin/mysqld (server 10.8.3-MariaDB-log) starting as process 1894 ...
Sep 05 22:20:02 suse-tom mysql-systemd-helper[1874]: MySQL is still dead
Sep 05 22:20:02 suse-tom mysql-systemd-helper[1874]: MySQL didn't start, can't continue
Sep 05 22:20:02 suse-tom systemd[1]: mariadb.service: Control process exited, code=exited, status=1/FAILURE
Sep 05 22:20:02 suse-tom systemd[1]: mariadb.service: Failed with result 'exit-code'.
Sep 05 22:20:02 suse-tom systemd[1]: Failed to start MariaDB database server.

这时候只是报mysqld启不了,没有更详细的信息。查看mariadb.service的systmd文件,找到mysql-systemd-helper的对应位置,尝试运行一下helper

suse-tom:/usr/libexec/mysql # cat /usr/lib/systemd/system/mariadb.service
...
[Service]
ExecStartPre=/usr/libexec/mysql/mysql-systemd-helper  install
ExecStartPre=/usr/libexec/mysql/mysql-systemd-helper  upgrade
ExecStart=/usr/libexec/mysql/mysql-systemd-helper     start
...
suse-tom:/usr/libexec/mysql # /usr/libexec/mysql/mysql-systemd-helper 
Supported commands are:
   install - creates empty database if needed
   upgrade - tries to migrate data to newer version if needed
   start   - tries to start instance
   wait    - waits till instance is pingable
All commands can take extra argument which is group from 'mysqld_multi' you want to work with

带个upgrade参数运行一下,出错,查看mysql的error log

suse-tom:/usr/libexec/mysql # cat /var/log/mysql/mysqld.log
2022-09-05 23:04:14 0 [Warning] No argument was provided to --log-bin and neither --log-basename or --log-bin-index where used;  This may cause repliction to break when this server acts as a master and has its hostname changed! Please use '--log-basename=suse-tom' or '--log-bin=suse-tom-bin' to avoid this problem.
2022-09-05 23:04:14 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-09-05 23:04:14 0 [Note] InnoDB: Number of transaction pools: 1
2022-09-05 23:04:14 0 [Note] InnoDB: Using generic crc32 instructions
2022-09-05 23:04:14 0 [Note] InnoDB: Using Linux native AIO
2022-09-05 23:04:14 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2022-09-05 23:04:14 0 [Note] InnoDB: Completed initialization of buffer pool
2022-09-05 23:04:14 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
2022-09-05 23:04:14 0 [Note] InnoDB: 128 rollback segments are active.
2022-09-05 23:04:14 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2022-09-05 23:04:14 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2022-09-05 23:04:14 0 [Note] InnoDB: log sequence number 1110270; transaction id 322
2022-09-05 23:04:14 0 [Note] InnoDB: Loading buffer pool(s) from /home/tom/mysql-data/ib_buffer_pool
2022-09-05 23:04:14 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-09-05 23:04:14 0 [Note] InnoDB: Buffer pool(s) load completed at 220905 23:04:14
2022-09-05 23:04:14 0 [ERROR] /usr/sbin/mysqld: unknown variable 'password=123456'              #<------这里发现是由于配置文件的问题,不适配更新后的mysql
2022-09-05 23:04:14 0 [ERROR] Aborting

修改注释掉my.cnf配置后,再运行发现报错

Sep 05 23:22:19 suse-tom mysql-systemd-helper[3091]: /usr/sbin/mysqld: One can only use the --user switch if running as root  #这里依然是配置文件固定了root用户,导致出错,注释掉

最终排错,是因为更新mariadb后,原来的配置不通过,导致出错。

修复更新后的数据库

suse-tom:/home/tom/mysql-db # mysql_upgrade -uroot -p
Enter password: 
Major version upgrade detected from 10.5.10-MariaDB to 10.8.3-MariaDB. Check required!
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK

https://forums.opensuse.org/showthread.php/535352-MariaDB-doesn-t-start-after-zypper-upgrade-to-mariadb-10-2-22-lp150-2-9-1-x86_64

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值