Jump to content

Create MySQL user and database - help needed


Dennis

Recommended Posts

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

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

  • 7 months later...
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

Archived

This topic is now archived and is closed to further replies.

  • Who's Online   0 Members, 0 Anonymous, 25 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use