How to recover/recreate mysql’s default ‘mysql’ database

If you are still able to log in (I assume you aren’t since there’s no user table) and have databases to save, dump them with

mysqldump --routines databasename > outfile.sql

The MySQL database can be recreated with the command

# Most MySQL versions

# MySQL 5.7 and later
mysqld --initialize

MySQL Documentation here

Leave a Comment