I can't connect to my online database, I'm using the cPanel of GoDaddy. I tried to add a host in remote MySQL, like '192.68.0.%' but same error gets thrown. The connection string that I used in this is the same connection string that I used on my website.
My code:
Try
Dim MySQLConnection = New MySqlConnection
MySQLConnection.ConnectionString = "server=www.***.com; port=3306; user=username; password=password; database=database;"
MySQLConnection.Open()
MsgBox("Success!")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
I also tried this:
Try
Dim MySQLConnection = New MySqlConnection
MySQLConnection.ConnectionString = "localhost; port=3306; user=username; password=password; database=database;"
MySQLConnection.Open()
MsgBox("Success!")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
I get this error with both codes:
Authentication to host '148.72.232.107' for user 'username' using method 'mysql_native_password' failed with message: Access denied for user 'username'@'49.148.94.47' (using password: YES)
Solve this by:
In my error I add '49.148.94.47'. I can now connect to my online database using MySQL, GoDaddy - cPanel.
Dim cnQ As New SqlConnection("Data Source=Server_IP;Initial Catalog=DataBase_Name;User ID=you_User_Name;Password=your_Password;")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.