I have been trying to connect to a MySQL database but have been getting exception 0x80131904: The server was not found. I know the server is running and I can query it through the command line. I have also made sure skip networking is not enabled. What am I doing wrong?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Connecting to database...");
SqlConnection sqlserver = new SqlConnection("user id=<removed>;" +
"password=<removed>;server=localhost;" +
"Trusted_Connection=yes;" +
"database=ircbot; " +
"connection timeout=5");
try
{
sqlserver.Open();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Connected");
Console.ResetColor();
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(e.ToString());
Console.ResetColor();
}
Console.ReadLine();
} //end main
} //end class Program