If you need to create a database, and you don’t want to bother logging into a graphical interface, you can do this via the command line with a few simple commands.
First, if the database already exists, you’ll need to delete it with the following command.
mysql -u root -p$password -e 'DROP DATABASE $targetdb;'
This will delete the database from MySQL
Now you can create the database. This command will create the database for you.
mysql -u root -p$password -e 'CREATE DATABASE $targetdb;'
Next you’ll need to create a user/password, and assign it to the new database. Use this command
mysql -u root -p$password -e 'GRANT ALL ON `$targetdb`.* TO "$dbuser"@"localhost" IDENTIFIED BY "$dbpass";'
This will give full permisions to a new user called $dbuser to the database $targetdb, with the password you set in $dbpass.
Finally, you should run:
mysql -u root -p$password -e 'FLUSH PRIVILEGES;'
This will flush all the privileges in mysql. Essentially reloading all user permissions in MySQL.
You can now connect to this database, and create any tables, records, etc, that you need to create.