Creating a new user using script

I want to know how can I add a new user without logging into the cms. And is there any method to just connect to mysql db and create the new user?

I didnt find any solution, does anyone have an idea?