文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>[转]Simple Bash Script to install MySQL - Need some help

[转]Simple Bash Script to install MySQL - Need some help

时间:2011-04-13  来源:^希望^

I am writing a simple bash script to install MySQL on Ubuntu.

However MySQL prompts for a password and confirmation. How do I pass along a root password. Is there an echo I can use?

Thank you,

Cei

 

 

Thank you for the tip on expect. I couldn't find anything by searching Ubuntu admin forums so I went with expect. As you can see by the timestamp of this post, it took me 3 hours to get it working. Here is the code, I hope it can help someone:

/etc/init.d/mysql start 

 

 

 

This is an excerpt from my setup script for new servers. You should be able to copy it word-for-word except for the password.

You'll need to run this using sudo if you're not already root.

echo "Done setting mysql password." 

 

 Other answers have used the -y which makes apt-get always answer yes to questions. The -q hides some progress indicators so you can send the output to a log. You could also use -qq, which automatically gives you a -y. This is in the man page for apt-get.

 

The <<EOSQL is a bash heredoc syntax for readability.

 The easiest way to do this is to use the DEBIAN_FRONTEND environment variable and the aptitude -q and -y flags:

 

Or more generically, assuming sudo password has been catered for some-how:

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载