阿里服务器,问题一:Mysql无法连接

今天将代码迁移到阿里共享虚拟机里面,然后却无法显示数据库内容,由于在本地是没有问题的,所以猜测是无法连接到数据库,于是就使用log记录了一下,log内容如下:

2018-08-18 18:29:29.2500 | Info | Test before connection: 
2018-08-18 18:29:29.4218 | Info | Test Log 
2018-08-18 18:29:29.5156 | Info | exception: System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> MySql.Data.MySqlClient.MySqlException: Authentication with old password no longer supported, use 4.1 style passwords.
   在 MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
   在 MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
   在 MySql.Data.MySqlClient.NativeDriver.Open()
   在 MySql.Data.MySqlClient.Driver.Open()
   在 MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   在 MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   在 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   在 MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   在 MySql.Data.MySqlClient.MySqlPool.GetConnection()
   在 MySql.Data.MySqlClient.MySqlConnection.Open()
   在 MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection connection)
   在 System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
   --- 内部异常堆栈跟踪的结尾 ---
   在 System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
   在 MySql.Data.Entity.MySqlManifestTokenResolver.ResolveManifestToken(DbConnection connection)
   在 System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
   在 System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
   在 System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
   在 System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
   在 System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   在 System.Data.Entity.Internal.InternalContext.Initialize()
   在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   在 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   在 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   在 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   在 System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)
   在 MyBlogNew.Controllers.DiaryController.GetDiaries(Int32 pageIndex, Int32 pageSize) 
 <no type>.lambda_method => DiaryController.GetDiaries => LoggerHelper.Info 

本以为是没有授权,后来找了下百度,原来是修改了密码方式,可参看该文章:

C# mysql 链接 遇到 异常 Authentication with old password no longer supported, use 4.1 style passwords.

解决方案:

执行这两句:

SET old_passwords=FALSE;

SET PASSWORD = PASSWORD('重设密码');

2789632-4e89efe22b0825a1.png
2789632-3b18269684ea9294.png
公众号.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值