ERROR 1049 (42000): Unknown database 'blooddonarapp'

8k Views Asked by At

i'm using AWS binami Ubuntu 14.04 and mysql 5.6.29. i was created database BloodDonarApp but after some day when using show databases command its listing databases but while i'm use database it showing ERROR 1049 (42000): Unknown database 'blooddonarapp' below i mentioned my terminal result. For this any solution is there. Thanks for advance.

  mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | ATM                |
    | BloodDonarApp      |
    | FixMyRide          |
    | NEG                |
    | NVgoods            |
    | PMS                |
    | Translogix         |
    | kishore            |
    | mysql              |
    | performance_schema |
    | sample             |
    | test               |
    | vasanth            |
    +--------------------+
    14 rows in set (0.00 sec)

    mysql> use BloodDonarApp;
    ERROR 1049 (42000): Unknown database 'blooddonarapp'
    mysql>
2

There are 2 best solutions below

0
On

Depending on how MySQL was installed, it is possible that the default MySQL database was NOT created. This may be checked by looking in /var/lib/mysql for a mysql subfolder (i.e. /var/lib/mysql/mysql ). If the path does NOT contain a mysql subfolder, it needs to be created by completing the following steps:

rcmysql stop pkill mysql (NOTE: wait until notification is given that mysqld ended, then hit ) /usr/bin/mysql_install_db

Now that the above steps have been run, check and make sure that the database was created:

cd /var/lib/mysql ls -al | grep mysql

In the listing output there should now be a folder called mysql. Finally, the correct owner and group need to be set on the mysql folder.

chown mysql:mysql mysql

Restart the mysql service in safe mode again and attempt the initial command again:

mysql --user=root mysql

2
On

Solution:

  1. Create new database in lower case.
  2. Dump structure and data from camel case db.
  3. Execute dump into lower case db.
  4. Try to use db again.

MySQL transform schema name to lower case and then compare with existing schemes.

Those steps will fix your problem.

Thanks