If you have completely removed the existing MySQL 5.7 database on your server and need to recreate the default database you can use the following procedure to do so.
Stop MySQL if it is currently running:
The existing mysql data directory must be completely empty. If there are any existing files, you must either remove them or move them to a different location:
mv -v /var/lib/mysql/* /root/to-be-deleted-or-restored-after-review
It would be advisable to restore the MySQL configuration to the default unless you know that your custom configuration is valid:
# For advice on how to change settings please see
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
# Disabling symbolic-links is recommended to prevent assorted security risks
Issue the following command via SSH as the root user to recreate the default database:
mysqld --initialize --user=mysql
Start MySQL with the following command