Dennis Posted April 27, 2013 Share Posted April 27, 2013 Hi. We want the controlpanel to automaticly create a user and a database for MySQL when a Minecraft server is created. However, I need some help. This is the simple batch script I have made: @echo off set root=C:\mysql\bin cd %root% mysql -h localhost -u root -p -e "CREATE DATABASE IF NOT EXISTS test"; mysql -h localhost -u root -p -e "CREATE USER 'username_here'@'localhost' IDENTIFIED BY 'password_here'"; mysql -h localhost -u root -p -e "GRANT ALL ON test.* TO 'username_here'@'localhost'"; How can I use the TCAdmin username and/or password for the database user? Link to comment Share on other sites More sharing options...
KyleSmith Posted April 27, 2013 Share Posted April 27, 2013 Link to comment Share on other sites More sharing options...
CloudCUBE Posted April 27, 2013 Share Posted April 27, 2013 http://help.tcadmin.com/ThisUser @echo off set root=C:\mysql\bin cd %root% mysql -h localhost -u root -p -e "CREATE DATABASE IF NOT EXISTS test"; mysql -h localhost -u root -p -e "CREATE USER '%ThisUser_UserName%'@'localhost' IDENTIFIED BY '%ThisUser_Password'"; mysql -h localhost -u root -p -e "GRANT ALL ON test.* TO '%ThisUser_UserName%'@'localhost'"; This method works however if the user changes their original gamepanel password the database wont change. I would suggest using "Capture values before executing the script" Then the client can define their own password. and allow a script on root to allow a password change. Link to comment Share on other sites More sharing options...
Ownerz Posted December 27, 2013 Share Posted December 27, 2013 http://help.tcadmin.com/ThisUser @echo off set root=C:\mysql\bin cd %root% mysql -h localhost -u root -p -e "CREATE DATABASE IF NOT EXISTS test"; mysql -h localhost -u root -p -e "CREATE USER '%ThisUser_UserName%'@'localhost' IDENTIFIED BY '%ThisUser_Password'"; mysql -h localhost -u root -p -e "GRANT ALL ON test.* TO '%ThisUser_UserName%'@'localhost'"; This method works however if the user changes their original gamepanel password the database wont change. I would suggest using "Capture values before executing the script" Then the client can define their own password. and allow a script on root to allow a password change. Can you explain how I set this up in TCadmin or on my dedi? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.