The use of the initial execution file during mysql startup can be specified in the configuration file for the SQL file that is initially executed after mysql is started. The syntax is as follows: [mysqld] or [server: www.2cto.com init-file = D :\ mysql-5.5.28-winx64 \ abc. SQL. Pay attention to the following two points for the specific SQL file values: 1. make sure that the -- disable-grant-options switch is not added during mysqld compilation. 2. Make sure that each line of the script specified by init-file is a specific executable statement. For example: abc. SQL: use test; begin; create table if not exists t123 (id int); insert into t123 values (1); insert into t123 values (2); select * from t123; -- drop table t123; end; after mysql is started, query: <pre name = "code" class = "SQL"> mysql> use test; database changed mysql> select * from t123; + ------ + | id | + ------ + | 1 | 2 | + ------ + 2 rows in set (0.00 sec) </pre> <br> after the second startup, the following result is displayed: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 2 Server version: 5.5.28 MySQL Community Server (GPL) Copyright (c) 2000,201 2, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or its affiliates. other names may be trademarks of their respective owners. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> use test; Database changed mysql> select * from t123; + ------ + | id | + ------ + | 1 | 2 | 1 | 2 | + ------ + 4 rows in set (0.00 sec)