You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MySQL数据迁移时无法设置root密码的问题求助

MySQL大体积数据迁移时root密码配置失败问题

迁移场景与执行步骤

需迁移270GB MySQL数据(含datadir内的数据库及用户数据)至新服务器,为缩短停机时间采用rsync同步数据。两台服务器基于同一款Ubuntu AMI,仅数据存在差异。执行的迁移操作步骤如下:

sudo service mysql stop 
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean 
sudo apt-get purge mysql* 
sudo apt-get update 
sudo apt-get install -f 
sudo apt-get install mysql-server-5.5

出现的错误提示

安装mysql-server-5.5过程中设置root密码时,弹出错误:

Configuring mysql-server-5.5

Unable to set password for the MySQL "root" user

An error occurred while setting the password for the MySQL administrative
user. This may have happened because the account already has a password, or
because of a communication problem with the MySQL server.

You should check the account's password after the package installation.

Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more
information.

补充说明

  • 同款AMI的开发服务器执行完全相同步骤可成功完成配置
  • 两台服务器仅迁移的数据存在差异
  • 明确Ubuntu及MySQL版本老旧,但此次迁移为必须操作且有严格时间限制

内容的提问来源于stack exchange,提问作者somya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 23:45:40