@@ -51,18 +51,15 @@ func (this *Inspector) InitDBConnections() (err error) {
5151 if this .db , _ , err = mysql .GetDB (this .migrationContext .Uuid , inspectorUri ); err != nil {
5252 return err
5353 }
54- if err := this .validateConnection (); err != nil {
55- return err
56- }
57- if this .migrationContext .InspectorServerInfo , err = mysql .GetServerInfo (this .db ); err != nil {
58- return err
59- }
6054
6155 informationSchemaUri := this .connectionConfig .GetDBUri ("information_schema" )
6256 if this .informationSchemaDb , _ , err = mysql .GetDB (this .migrationContext .Uuid , informationSchemaUri ); err != nil {
6357 return err
6458 }
6559
60+ if err := this .validateConnection (); err != nil {
61+ return err
62+ }
6663 if ! this .migrationContext .AliyunRDS && ! this .migrationContext .GoogleCloudPlatform && ! this .migrationContext .AzureMySQL {
6764 if impliedKey , err := mysql .GetInstanceKey (this .db ); err != nil {
6865 return err
@@ -217,11 +214,15 @@ func (this *Inspector) inspectOriginalAndGhostTables() (err error) {
217214}
218215
219216// validateConnection issues a simple can-connect to MySQL
220- func (this * Inspector ) validateConnection () error {
217+ func (this * Inspector ) validateConnection () ( err error ) {
221218 if len (this .connectionConfig .Password ) > mysql .MaxReplicationPasswordLength {
222219 return fmt .Errorf ("MySQL replication length limited to 32 characters. See https://dev.mysql.com/doc/refman/5.7/en/assigning-passwords.html" )
223220 }
224221
222+ if this .migrationContext .InspectorServerInfo , err = mysql .GetServerInfo (this .db ); err != nil {
223+ return err
224+ }
225+
225226 return base .ValidateConnection (this .ServerInfo (), this .connectionConfig , this .migrationContext , this .name )
226227}
227228
0 commit comments