Sample Header Ad - 728x90

Creating MySQL database and user without password

2 votes
1 answer
3496 views
I am building a set of bash scripts which basically prepare apache virtual hosts, git repositories and other stuff on a cloud server. So far so good, everything is working, but a big problem occurred: **MySQL database and users creation**. The current scripts use ssh with keys to authenticate to the cloud server and everyone from my team can execute commands. I want to keep it this way and somehow let them create new MySQL database and user without needing to login to mysql as root or any other user with high privileges, but I don't have any solution for this. **Idea #1** is to create a new mysql user without password and give it full rights (like root) but make it usable only @'localhost'. **Idea #2** is to store the password for this MySQL control user in a file and make it accessible only to the current ssh user which the other scripts use. Then the mysql login will use this stored password to login and create the database and user. I don't know which option is better and I know they are dangerous. I ask for opinion and any better ideas.
Asked by Ivan Dokov (205 rep)
May 10, 2014, 02:11 PM
Last activity: May 17, 2025, 03:04 PM