Re: Where is database?
Posted by: Scott Stewart
Date: January 20, 2015 12:45PM

I have seen that and several more examples. But the problem is not the connection. If I use the following Connection string to connect I get an error, not when opening the connection but when trying to read data.;

connectionString="Server=localhost; Uid=root; Pwd=admin";
connection =new MySqlConnection(connectionString);


MySqlCommand cmd = new MySqlCommand(sql, connection);
MySqlDataReader reader = cmd.ExecuteReader();

this is where an exception is thrown when I DO NOT specify a database in the connection string. I catch the exception and display it in a message box - messagebox(ex.message); It says "No database selected."

If I include the name of the database in my connectionString as so many examples show, I get Error 0 thrown;

connectionString="Server=localhost; Database=Flight_log_db; Uid=root; Pwd=admin;
connection = new MySqlConnection(connectionString);

This is where it throws an exception which I catch and display the details in a messagebox. It says; Connot connect to server. Error #: 0. Authentication to 'localhost' using method 'mysql_native_password' failed with message: Unknown database 'flight_log_db'

I cannot find in Workbench anything about a database. The only file I have been able to find on my entire hard drive is Flight_log_db.mwb which is the workbench file.

What am I missing?

Scott Stewart
Learning one bit at a time.

Options: ReplyQuote

Written By
January 20, 2015 11:36AM
January 20, 2015 11:45AM
Re: Where is database?
January 20, 2015 12:45PM
January 20, 2015 01:20PM
January 20, 2015 01:29PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.