MYSQL – ERROR 1049 (42000): Unknown database ‘mydatabasename’

ERROR 1049 (42000): Unknown database ‘mydatabasename’

mysql -uroot -pmypassword mydatabase

When i execute the above command i am getting the following error, i have also given all the permission to the user upon this database.

ERROR 1049 (42000): Unknown database 'mydatabasename'

Solution:

# Remove DataBase:

DROP DATABASE mydatabasename;

# Create DataBase:

CREATE DATABASE mydatabasename;
USE mydatabasename; 

# Restore DataBase
You may just use in CLI:

mysql -uroot –pmypassword < mydatabase.sql