Jump to content
  • 0
Sign in to follow this  
ToiletMaster

Linux Commands for MySQL

Question

Hello,

 

Just want to know what is the command that is enough for MySQL to allow it run in the inter-server.conf?

 

 

as right now i'm doing it like this which i believe is wrong lol

 

grant all privileges on *.* to name@whatever identified by 'password';

so what would be the best command to replace this?

Share this post


Link to post
Share on other sites

17 answers to this question

Recommended Posts

  • 0

 

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, EXECUTE ON ROdatabase.* TO 'user'@'host';

 

The emulator is never going to attempt to create/drop/alter a table. I'd leave those off.

Share this post


Link to post
Share on other sites
  • 0

I've also never seen an emulator executing procedures in MySQL. But I'd keep CREATE, DROP and ALTER permissions for source mods and scripts which make use of it if tables don't exist. I've seen quite a lot of scripts auto installing if the table hasn't already been created (CREATE TABLE IF NOT EXISTS).

 

Don't like this behavior, though, but I must admit this is quite comfortable. Possible problems is letting a third-party NPC or source mod dropping your tables (main reason why I don't like it).

Share this post


Link to post
Share on other sites
  • 0

It's like 1 account to play with a specific group of database, and I only use and login my superuser account to create/manage accounts. nvm xD.

 

just use SELECT, INSERT, UPDATE, DELETE for the topic, then use your superaccount to manage other things.

Share this post


Link to post
Share on other sites
  • 0

I see i see, thanks for the great assistance everyone!

 

I'll try it out and see how it fairs on my end!

 

However 1 more question if you don't mind xD,

 

cause in terms of deleting everything from their account except their ID and passwords,

 

what would that be? as well as inserting one item into their storage for all the accounts registered.

 

Thanks for the great info everyone!

Share this post


Link to post
Share on other sites
  • 0

[Error]: make_listen_bind: bind failed (socket #4, error 98: Address already in use)!
 

I keep getting this error though, What's the issue here? :(

 

and this is the command that i used

 

Fixed xD,

GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, EXECUTE ON DB1.* TO name@host identified by 'password'; & GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, EXECUTE ON DB2.* TO name@host identified by 'password';

 

however the only thing that bugs me a bit would be this

 

[Warning]: You are running Hercules with root privileges, it is not necessary.

 


Using the command stated above, is it still safe? or am i still in trouble for this?

Edited by ToiletMaster

Share this post


Link to post
Share on other sites
  • 0

cause in terms of deleting everything from their account except their ID and passwords,

For this you should have a lot of care. If you want to wipe all your server data and ONLY leave accounts alive (which is what I think you want), I'd truncate (TRUNCATE TABLE `table_name`) all tables except `login` and (optionally) `mapreg`. Truncating a table means emptying all of its content and setting the auto_increment values to 1. Making backup is highly advised before doing this.

 

 

as well as inserting one item into their storage for all the accounts registered.

Can't tell you right now, I'd better use PHP for this and insert it with 2 queries: one for getting all the account ids and another for inserting a value on the storage table for them.

 

For the warning, it means you're running it as a root superuser in your Linux system and you're advised not to do that ecause consequences may be fatal if someone manages to take over your system via the game, because they're allowed to do anything as root. That's not MySQL related.

Share this post


Link to post
Share on other sites
  • 0

Thanks jaBote for the advice!

 

and yes! you're right on that part, as i'm a dunce when it comes to MySQL commands, therefore I'd like to ask for this >_>, I don't use phpmyadmin though, as all my operations are within my server and nothing comes remotely.

 

 

For the warning, it means you're running it as a root superuser in your
Linux system and you're advised not to do that ecause consequences may
be fatal if someone manages to take over your system via the game,
because they're allowed to do anything as root. That's not MySQL
related.

 

 

Thank you so much to telling me this! I kinda got used to logging in as root, that's why this happened I guessed lol.

Anyway the warning is long gone now thanks!

 

However, I usually use MySQL Workbench to do this though, Correct me if i'm wrong, but i don't see the option of truncate here. Unless I manually delete it? Which leaves the option of adding the items into their storage xD

Share this post


Link to post
Share on other sites
  • 0

It is NEVER a good practice to use root for anything (Or Administrator for windows), as a faulty piece of code/script or whatever else could end up screwing your entire OS installation. 

 

You can always "sudo" something if you have the need to.

 

I've never used workbench for anything, so no idea there.

To empty a table as jaBote mentioned before, you can use truncate as an sql command

To insert data simply do INSERT into `table` (`col1`, `col2`, `col3`) VALUES('string1', int1, 'string2');

 

For storage for example, you can do this

 

INSERT INTO  `storage` (`id` ,`account_id` ,`nameid` ,`amount` ,`equip` ,`identify` ,`refine` ,`attribute` ,`card0` ,`card1` ,`card2` ,`card3` ,`expire_time` ,`unique_id`)VALUES (NULL ,  2000000,  500,  5,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0);

That'd insert into Account 200000 5 (amount) Red Potions (nameid 500). 

Share this post


Link to post
Share on other sites
  • 0

It is NEVER a good practice to use root for anything (Or Administrator for windows), as a faulty piece of code/script or whatever else could end up screwing your entire OS installation. 

 

You can always "sudo" something if you have the need to.

 

I've never used workbench for anything, so no idea there.

To empty a table as jaBote mentioned before, you can use truncate as an sql command

To insert data simply do INSERT into `table` (`col1`, `col2`, `col3`) VALUES('string1', int1, 'string2');

 

For storage for example, you can do this

 

INSERT INTO  `storage` (`id` ,`account_id` ,`nameid` ,`amount` ,`equip` ,`identify` ,`refine` ,`attribute` ,`card0` ,`card1` ,`card2` ,`card3` ,`expire_time` ,`unique_id`)VALUES (NULL ,  2000000,  500,  5,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0);

That'd insert into Account 200000 5 (amount) Red Potions (nameid 500). 

Thanks for the information!

 

However would there be a specific command to place an item to all accounts without manually typing in one by one?

 

Sorry if this request is absurd as i'm trying to grasp as much of the MySQL commands I can xD

Share this post


Link to post
Share on other sites
  • 0

Ouch, missed that part. Sorry

 

INSERT INTO `storage` (`account_id`, `nameid`, `amount`, `identify` )SELECT  `login`.`account_id`, ItemID, qty, 1FROM `login`where `login`.`account_id`>=2000000;

That will add the item to storage, replace itemID and qty as needed. 

The final 1 makes the item identified.

You can add other columns and values, but thats the main structure =)

Share this post


Link to post
Share on other sites
  • 0

Ouch, missed that part. Sorry

 

INSERT INTO `storage` (`account_id`, `nameid`, `amount`, `identify` )SELECT  `login`.`account_id`, ItemID, qty, 1FROM `login`where `login`.`account_id`>=2000000;

That will add the item to storage, replace itemID and qty as needed. 

The final 1 makes the item identified.

You can add other columns and values, but thats the main structure =)

 

 

Thanks I'll definitely try it out and see how it works!

 

and thanks for the great knowledge guys! You've really helped me out on this part xD

 

I do have a few questions for linux but i think i'll pass it first since I've asked alot xD

 

Cheers everyone!

Share this post


Link to post
Share on other sites
  • 0

Don't worry, feel free to make them =)

As long as you're willing to actually learn, none will mind giving you a hand (Y)

Share this post


Link to post
Share on other sites
  • 0

Don't worry, feel free to make them =)

As long as you're willing to actually learn, none will mind giving you a hand (Y)

 

 

haha okay then thanks! Then i'll shoot up a question then,

 

After doing some googling, i found out that using chmod 777

 

it's very dangerous as anyone can do anything to it.

 

To put it in layment term,

 

it's basically putting the key in your car locked in a garage.

 

So if people can go into the garage, your car is more or stolen lols.

 

However, the Flux CP wouldn't run without 777. as i tried changing various times, but 777 managed to work and I strongly believe it will hinder it's security.

 

So what should I do on this part? I understand that Flux CP tells you which directory permission is required for that folder if the permission set is wrong, but even though i followed, it came with more and more errors.

 

i'm in a complete confusion on what should I do now for the Flux lol

Share this post


Link to post
Share on other sites
  • 0

I am not entirely sure how does FluxCP, but in general the main risk of 777 is that everyone (you, group and others) read/write/execute the files and folder.
You might want to assign apache's user to your flux cp installation group
 
The group is usually called the same as the user account (but you an check your group by doing "groups user" ex: "groups toiletmaster")
And then ls -lh to check to which group the folders are assigned to (if you changed it)
 
With the group identified, you can simply do:
sudo usermod -a -G <group> <apache user> (No </>. ex assuming your httpd daemon runs under user "apache": sudo usermod -a -G toiletmaster apache)

 

That way you can easily chmod your files/folders to 775 and avoid other users from modifying your files. 

Share this post


Link to post
Share on other sites
  • 0

I am not entirely sure how does FluxCP, but in general the main risk of 777 is that everyone (you, group and others) read/write/execute the files and folder.

You might want to assign apache's user to your flux cp installation group

 

The group is usually called the same as the user account (but you an check your group by doing "groups user" ex: "groups toiletmaster")

And then ls -lh to check to which group the folders are assigned to (if you changed it)

 

With the group identified, you can simply do:

sudo usermod -a -G <group> <apache user> (No </>. ex assuming your httpd daemon runs under user "apache": sudo usermod -a -G toiletmaster apache)

 

That way you can easily chmod your files/folders to 775 and avoid other users from modifying your files. 

Thanks for the tip!

 

However i can't make this happen though.

 

not sure whether is it my issue or something >_>

 

still a noob in Linux hahaha

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.