{"id":20095757,"url":"https://github.com/magepsycho/mysql-user-db-creator-bash-script","last_synced_at":"2025-05-06T05:31:18.596Z","repository":{"id":30953956,"uuid":"126456516","full_name":"MagePsycho/mysql-user-db-creator-bash-script","owner":"MagePsycho","description":"Script to create a mysql database, user and password with just a command","archived":false,"fork":false,"pushed_at":"2021-11-25T16:39:32.000Z","size":105,"stargazers_count":28,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T08:51:12.417Z","etag":null,"topics":["bash","bash-script","database-management","mysql","mysql-database","password","password-generator","shell","shell-script","username"],"latest_commit_sha":null,"homepage":"https://blog.magepsycho.com/bash-script-create-mysql-database-user-optional-password/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MagePsycho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-23T08:36:39.000Z","updated_at":"2024-12-25T03:54:06.000Z","dependencies_parsed_at":"2022-08-07T16:00:26.998Z","dependency_job_id":null,"html_url":"https://github.com/MagePsycho/mysql-user-db-creator-bash-script","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmysql-user-db-creator-bash-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmysql-user-db-creator-bash-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmysql-user-db-creator-bash-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmysql-user-db-creator-bash-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MagePsycho","download_url":"https://codeload.github.com/MagePsycho/mysql-user-db-creator-bash-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252628893,"owners_count":21779100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","database-management","mysql","mysql-database","password","password-generator","shell","shell-script","username"],"created_at":"2024-11-13T16:56:20.620Z","updated_at":"2025-05-06T05:31:17.506Z","avatar_url":"https://github.com/MagePsycho.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MySQL Database, User/Password Creator\n\nThis Script helps you to create a new MySQL database with specific user \u0026 password with just a single command.\n\n\n## INSTALL\nTo install, simply download the script file and give it the executable permission.\n```\ncurl -0 https://raw.githubusercontent.com/MagePsycho/mysql-user-db-creator-bash-script/master/src/mysql-db-user-creator.sh -o mysql-db-user-creator.sh\nchmod +x mysql-db-user-creator.sh\n```\n\nTo make it system wide command\n```\nsudo mv mysql-db-user-creator.sh /usr/local/bin/mysql-db-user-creator\n```\n\n## USAGE\n### To display help\n```\nsudo ./mysql-db-user-creator.sh --help\n```\n\nIn General, basic usage\n```\n./mysql-db-user-creator.sh [--host=\"\u003chost-name\u003e\"] --database=\"\u003cdb-name\u003e\" [--user=\"\u003cdb-user\u003e\"] [--pass=\"\u003cuser-password\u003e\"]\n```\n**Notes**:  \n- The only required parameter is `database` name. \n- Default parameter values:  \n\n| Parameter | Default Value |\n|-|-|\n| `host` | localhost |\n| `user` | same as database name |\n| `password` | randomly generated |\n\nAnd MySQL credentials for new db/user creation will be taken from the MySQL config file `~/.my.cnf`.  \nIf you don't have one, you can simply create a `.my.cnf` file in home directory, with\n```\n[client]\nhost=localhost\nuser=[your-db-user]\npassword=[your-db-pass]\n```\n*If `~/.my.cnf` doesn't exist, you will be prompted for the root password. For an automated enviroment it's recommended to make use of MySQL config file.*\n\n\n### To Create Db along with specified User \u0026 Pass (By passing all parameters explicitly)\n```\n./mysql-db-user-creator.sh --host=192.168.1.55 --database=new-db-name --user=new-user --pass=some-strong-pass\n```\n\n### To Create Db with User \u0026 Pass (By passing only required parameter)\n```\n./mysql-create-db-user.sh --database=bash_db2\n```\n*In this case default values will be used for missing parameters (see above)*\n\n## Output Sample\n![MySQL DB, User/Password Creator Result](https://github.com/MagePsycho/mysql-user-db-creator-bash-script/raw/master/docs/mysql-user-db-creator-bash-script-result.png \"Nginx Virtual Host Creator Result\")\nScreentshot - MySQL DB, User/Password Creator Result\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fmysql-user-db-creator-bash-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagepsycho%2Fmysql-user-db-creator-bash-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fmysql-user-db-creator-bash-script/lists"}