@@ -109,7 +109,7 @@ internal protected void MyInit()
109109 string sql = sr . ReadToEnd ( ) ;
110110 sr . Close ( ) ;
111111
112- // SetAccountPerms(accessToMySqlDb);
112+ SetAccountPerms ( accessToMySqlDb ) ;
113113 sql = sql . Replace ( "[database0]" , database0 ) ;
114114 sql = sql . Replace ( "[database1]" , database1 ) ;
115115 initialSql = sql ;
@@ -126,19 +126,32 @@ public void SetupTest()
126126 if ( conn != null && conn . State == ConnectionState . Open )
127127 conn . Dispose ( ) ;
128128 SetupRootConnection ( ) ;
129+ SetAccountPerms ( false ) ;
129130 ExecuteSQLAsRoot ( initialSql ) ;
130131 Open ( ) ;
131132 }
132133
133134 protected void SetAccountPerms ( bool includeProc )
134135 {
135136 // now allow our user to access them
136- suExecSQL ( "DROP USER IF EXISTS 'test'@'localhost'" ) ;
137- suExecSQL ( "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test'" ) ;
138- suExecSQL ( String . Format ( @"GRANT ALL ON `{0}`.* to 'test'@'localhost'" , database0 ) ) ;
139- suExecSQL ( String . Format ( @"GRANT SELECT ON `{0}`.* to 'test'@'localhost'" , database1 ) ) ;
140- if ( Version . Major >= 5 )
141- suExecSQL ( String . Format ( @"GRANT EXECUTE ON `{0}`.* to 'test'@'localhost'" , database1 ) ) ;
137+ try
138+ {
139+ suExecSQL ( "DROP USER 'test'@'localhost'" ) ;
140+ }
141+ catch ( MySqlException ex )
142+ {
143+ if ( ex . Number != 1396 ) // Operation DROP USER failed
144+ throw ;
145+ }
146+ try
147+ {
148+ suExecSQL ( "DROP USER 'test'@'%'" ) ;
149+ }
150+ catch ( MySqlException ex )
151+ {
152+ if ( ex . Number != 1396 ) // Operation DROP USER failed
153+ throw ;
154+ }
142155
143156 if ( includeProc )
144157 {
0 commit comments