Missing database

[expired user #8337]'s profile image [expired user #8337] posted 10 years ago in Creating a connection Permalink
Hello everybody,

First of all, please bear with me as I am quite new to HeidiSQL, MySQL, and the concept of relational databases as a whole. I recently started using HeidiSQL in order to create tables for import into QlikView. A couple of weeks ago I upgraded from Windows 8.1 from Windows 8.0. This resulted in a number of errors that hindered my already set agenda for how to import files from Excel into HeidiSQl.

First of all, upon trying to open a new HeidiSQL session I am met by an error message stating the following:

“Error: SQL Error (2003) in statement #0: Can't connect to MySQL server on '(localhost)' (10061)”
Upon checking my MySQL workbench, I could see that my local server was not running, but was “stopped”. Attempting to start the server in the MySQL workbench did not help, however upon Googling the problem I managed to get the server running by finding the mysqld.exe file and running the file “as administrator”.

Getting the server running allowed me to start a session in HeidiSQL with the following details:
- Network type: MySQL (TCP/IP)
- Port: 3306
- Databases: Separated by semicolon

However, the only databases that show up are “information_schema”, “mysql”, and “performance_schema” and not the database that I am looking for, namely “(databasename)”. In the MySQL workbench, the following “schemas” are visible; “information_schema” and “performance_schema”. My question is, how do I go about finding and opening/restoring the aforementioned database?

I was hoping that some of you might have experienced this problem and could shed some light on a solution. If any more information is need regarding my setup, please let me know.
Thanks in advance.
jfalch's profile image jfalch posted 10 years ago Permalink
did you previously see a database named "(databasename)" when connecting to your mysql server ?
[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
Yes I did, both in Heidi and on my MySQL Workbench.
ansgar's profile image ansgar posted 10 years ago Permalink
And what happened with that database afterwards?
[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
It simply disappeared. I can no longer see the database in the MySQL workbench or HeidiSQL. There is a folder in my program data with the database name, however, there are not any SQL files in it. I don't know if this could be of any help to solving the problem.
jfalch's profile image jfalch posted 10 years ago Permalink
a database does not consist of sql files. If you were using the MyISAM engine for your database, the database directory will contain one or several files ending with .frm, .myd and .myi; if you were using InnoDB, there will be only .frm files (and possibly one .opt file). Do you see such files inside your (database) folder ?

Then, execute the query
SELECT @@datadir
Is the "folder in my program data with the database name" inside of this directory ? If not , it will not be recognized by the mysql server as a database.
[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
Hi jfalch,

Thanks for your response!

Executing the given query gets me to C:\Program Files\MySQL\MySQL Server 5.6\data\. Within this directory there is a folder with the database's name that contains ".frm", ".ibd", and ".opt" files.



[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
Wait, no.

The folder with the ".frm", ".ibd", and ".opt" files is located in C:\ProgramData\MySQL\MySQL Server 5.6\data.
jfalch's profile image jfalch posted 10 years ago Permalink
the two folder paths are different; that is probably the reason why you do not see the database in a mysql client. i suggest that you
a) stop the mysql server;
b) move the complete folder (database) from C:\ProgramData\MySQL\MySQL Server 5.6\data\ to C:\Program Files\MySQL\MySQL Server 5.6\data\ ;
c) start mysqld again.
The (database) should be back then.
[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
Hi again,

Thank you for the recommendation jfalch.

Following your instructions has gotten me a bit closer to the solution.

Upon moving the folder I can now see the desired database and its contents in my MySQL Workbench. However, in HeidiSQL the database seems to be empty. I can see the database along with the other schemas that i mentioned, yet this nothing "inside" of the database, i.e. when clicking the dropdown arrow, nothing appears, contrary to what happens in my MySQL workbench.

Any recommendations?

Thanks in advance!
jfalch's profile image jfalch posted 10 years ago Permalink
most probably heidisql´s "favourite filter" is switched on, and you do not have any favourites defined inside the database in question. directly below the menu bar, on the left above the database tree, there is a) a database filter field, b) a table filter field, and c) a single "star" icon. Try to click on this icon to switch the favourite filter to off. (n.b.: favourites are defined by clicking to the far left of a table name, where a small star will appear.)
[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
I have tried clicking on the star, but nothing changes. The desired database appears in Heidi with a green "check", and to the right of the database's name it says 0 KB.
[expired user #8337]'s profile image [expired user #8337] posted 10 years ago Permalink
I have tried clicking on the star, but nothing changes. The desired database appears in Heidi with a green "check", and to the right of the database's name it says 0 KB.
jfalch's profile image jfalch posted 10 years ago Permalink
"0 KB" also means that the database exists, but is empty (no tables found).
in mysql workbench, can you determeine what storage engine was used for the databases´ tables ? MyISAM or InnoDB are likely choices. (MyISAM tables are store in the above databse directory; InnoDB tables are not.)

Please login to leave a reply, or register at first.