您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Ubuntu上安装MySQL而没有密码提示

在Ubuntu上安装MySQL而没有密码提示

sudo debconf-set-selections <<< 'MysqL-server MysqL-server/root_password password your_password'
sudo debconf-set-selections <<< 'MysqL-server MysqL-server/root_password_again password your_password'
sudo apt-get -y install MysqL-server

对于特定版本,例如MysqL-server-5.6,您需要像这样指定版本:

sudo debconf-set-selections <<< 'MysqL-server-5.6 MysqL-server/root_password password your_password'
sudo debconf-set-selections <<< 'MysqL-server-5.6 MysqL-server/root_password_again password your_password'
sudo apt-get -y install MysqL-server-5.6

对于MysqL-community-server,密钥略有不同:

sudo debconf-set-selections <<< 'MysqL-community-server MysqL-community-server/root-pass password your_password'
sudo debconf-set-selections <<< 'MysqL-community-server MysqL-community-server/re-root-pass password your_password'
sudo apt-get -y install MysqL-community-server

将your_password替换为所需的root密码。(似乎your_password也可以留空以获取空白的root密码。)

如果您的外壳不支持 此处字符串zshksh93bash 支持它们),请使用:

echo ... | sudo debconf-set-selections
MySQL 2022/1/1 18:17:14 有449人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶