I am trying to wrap up one of our projects in Ubuntu/CentOS packages. The project is a typical web framework which requires to deploy a tomcat war file, create some directories and run a mysql script that creates a new user + database with some tables, etc.
Now I am not sure how to package up the mysql script. It should work either way if mysql has not yet been installed on the machine, or when the user already has a working mysql installed. The thing I am uncertain about is how to login in mysql with root so that I can add a new user and table.
Should I prompt the user for his mysql-root password during installation? This might add confusion. Or can I just bypass authentication? Assuming the process is executed as sudo either way, I might be able to do a mysqld_safe --skip-grant-tables &, and login with mysql-root without any password.
What is common practice when it comes to running a mysql script during the installation of a package?