This is just a simple PHP CLI script that, in just a few seconds, creates a new MySQL database, creates a new user, and grants the user full access to the database. It also uses the API from passwd.me to generate a random password for the new user.
This script is ideal to use when setting up a new WordPress installation on a development box.
To use the script:
-
Copy the config-sample.php file to config.php and replace the host, username, and password values with values that match your MySQL installation. You need root or another user with authority to create users and databases.
-
Run this file in the CLI, and enter the database name and the user name you want.
php mysql-quick-create.php
NOTE: This script requires CURL to be setup with your installation of PHP (for obtaining the random password).