Hi,
I've been trying to write a bash script to automate our site deployments. I've got it fetching our compressed file, extracting it to the right location, and setting file permissions/ownership. I also need to set up a MySQL database & user via the script, which is where I'm having some trouble.
I've got it creating a databse & user, which then appear in the cpanel account for that user. So that part is great. But I can't seem to grant permissions.
Can anyone tell me how I would grant my new user full privs on my new DB, and have that be reflected in cpanel? My level of experience here is pretty low.Code:sudo mysql --user=${MYSQL_USER} --password=${MYSQL_PASS} --execute="create database $DB_NAME" sudo mysql --user=${MYSQL_USER} --password=${MYSQL_PASS} --execute="CREATE USER '$DB_USER' IDENTIFIED BY '$DB_PASS'" sudo mysql --user=${MYSQL_USER} --password=${MYSQL_PASS} --execute="GRANT ALL ON ${DB_NAME}.* TO '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS'" sudo mysql --user=${MYSQL_USER} --password=${MYSQL_PASS} --execute="FLUSH PRIVILEGES"



LinkBack URL
About LinkBacks
Reply With Quote




