This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Altjen

Access denied for user 'user' error while trying to connect to DB

Question

I am trying to create a login system with MySQL 8 from DB4free.net. 

this is the source code:

Please login or register to see this code.

and I keep getting this error " MySqlException: Access denied for user 'altjenb'@'217.73.137.52' (using password: YES)
MySql.Data.MySqlClient.MySqlStream.ReadPacket ()"

 

and the comments unity shows for that are:

 


MySql.Data.MySqlClient.NativeDriver.AuthenticateNew ()
MySql.Data.MySqlClient.NativeDriver.Authenticate ()
MySql.Data.MySqlClient.NativeDriver.Open ()
MySql.Data.MySqlClient.Driver.Open ()
MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings)
MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection ()
MySql.Data.MySqlClient.MySqlPool.GetPooledConnection ()
MySql.Data.MySqlClient.MySqlPool.TryToGetDriver ()
UnityEngine.EventSystems.EventSystem:Update()

 

any suggestion?

Share this post


Link to post
Share on other sites

9 answers to this question

  • 0

Is there a reason your not using wwwforms and php?

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

As OcularCash mentioned, it would be much safer security wise and would be more easier to use php and wwwforms, but in this case, if you dont want to use it then, the error always references connection mistake, double check your string connection field, remove extra whitespaces infront of database,host,username and password, keep it simple.


NB! Also some hosts limit certain acces from certain ip's, under phpmyadmin you can see from hosts, which hosts are accepted by mysql server.

Edited by Andrus99
extra info

Share this post


Link to post
Share on other sites
  • 0

In this case anyone can get access to your database within a minute.

 

Even for tests better use one of free hosts (like it was done in tutorial):

 

 

Share this post


Link to post
Share on other sites
  • 0

 I wanted to do this more to learn. since this will be just a final year project and I have to do it on C#, it will be kinda weird to explain the teacher that I used php to connect when he said that only should use C#. 

 

Anyway, back to the problem. I tried the same with the localhost , it was the same error. and making some research saw that the new version of mysql didnt give full permission to the user. so in localhost I can easily do it. but at db4free.net I dont have full access to make that edition. so its kinda impossible to do that. unless the admin of the page changes that

Share this post


Link to post
Share on other sites
  • 0

I'd think he wouldn't mind you using php as a getter and setter to a database. Bc in all seriousness, the MySQL database isn't written in c#, so you wouldn't be using "all" c# anyways. The only true way would be to have a dedicated server that stores the information on a local drive using a custom c# application. But still, unity builds are c++, not c#, so final builds are not even in the target language. Would be kinda dumb if your teacher doesn't allow php as a simple get and set, especially when it just shows your knowledge of security protocols.

 

that being said and out of the way tho, there is tons of free databases that should grant full access. I believe square... something lol has free databases with no restrictions

Share this post


Link to post
Share on other sites
  • 0

Maybe this topic will help?

Please login or register to see this link.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

OMA, thats just an answer, no solutions for that post.

 

also OcularCash the php code should be on the computer or in a webhost? I mean, from the php code I connect to the db? or to the webhost then to the db

Share this post


Link to post
Share on other sites
  • 0

But he wrote that everything works perfectly. Problem is only with android build.
php must be on  webhost. These 2 tutorials shows you everything step by step. 

Share this post


Link to post
Share on other sites
  • 0

As oma said. Think of php like webpage that acts like a pointer that gets and set from the database. Most webpages that has MySQL also has a php section. Smallest example of php and unity I can find: Please login or register to see this link.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now