Error accessing C# Visual Studio database

Asked

Viewed 50 times

0

I’m doing a job of the facul, and I started him on the job this week, then came weekend I put the project on the USB stick and exported the database by Mysqlworkbench tbem, I was able to import the bank, but then when the program will access me an error, which is the following:

"Access denied for user 'root'@'localhost' (using password: YES)"

The password of the bank in my service is different, but I have already changed to the password that I use in the bank at home and even then does not work, follow the connection string

_conexaoMySQL = "server=localhost; user id = root;password=1234;database=frota";

Someone knows how to proceed?

1 answer

0

Go to the Mysql console and connect to the database and type:

SELECT Host, User FROM mysql.user;

Look for the localhost line, root. If it is not present create the user 'root'@'localhost' with your password, I will assume that the password is 1234 as in the question:

CREATE USER 'root'@'localhost' IDENTIFIED BY '1234';

Then grant all DML privileges to the root user@'localhost', I will assume that your database has the name frota as in the question:

GRANT ALL ON frota.* TO 'user'@'localhost' IDENTIFIED BY '1234';

Now try to log in by the c#.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.