Use of file Init-file when MySQL starts

Source: Internet
Author: User

In the configuration file, you can specify the SQL file that was initially executed after MySQL startup, with the following syntax:

Under [mysqld] Specify:

Init-file= "D:/mysql/test.sql", followed by a specific SQL file value.

Note that the following two o'clock is OK:

1. Make sure your mysqld compiles without the  --disable-grant-options switch. 2. Ensure that each line of the script specified by Init-file is a specific statement that can be executed.

Don't say much nonsense (mysql7 I used above). Straight into the subject: Test.sql:

 Usetest; begin; Create Table if  not existstest123 (IDint); Insert  intoTest123Values(1); Insert  intoTest123Values(2); Select *  fromtest123; --drop table test123; End;

After you start MySQL, you get a query to see

Use of file Init-file when MySQL starts

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.