Use of the initial execution file at mysql startup

Source: Internet
Author: User


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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.