When I installed mysql it came with two database, mysql and information schema. I accidentally deleted the mysql database. Is there any way I can recreate it?
Also, since it contains a table that contains user information, would there be any way I can view users' information without it?
In Database Explorer, right-click the server connection on which you want to restore the database and select Backup and Restore > Restore Database. In the Database Restore Wizard, select the backup file and click Restore.
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_install_db
# MySQL 5.7 and later
mysqld --initialize
MySQL Documentation here
read more at: https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html
On Windows, use one of these commands:
C:\> bin\mysqld --initialize
C:\> bin\mysqld --initialize-insecure
I recently installed mysql 8 and it seemed that there was a problem with mysql default databases. Anyway, this worked for me :
mysql_upgrade -u root -p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With