Ubuntu安装mysql时候如果通过shell实现自动输入密码
大家讲道理
大家讲道理 2017-04-17 12:05:57
0
3
613

!/bin/bash

apt-get install -y mysql-server

通过脚本安装mysql时,如何自动输入mysql root密码

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
洪涛

If you install it with root, you don’t need a password.
If you are an ordinary user and call sudo directly, you can only use methods such as expect, or change /etc/sudoers so that you do not need to enter a password.

洪涛

mysql -u root -ppasswd
root is the username, passwd is the user’s password

Note that there should be no space between -p and password

Is this what you mean?

伊谢尔伦
DEBIAN_FRONTEND=noninteractive apt install -y mysql-server
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!