Mysql实例mysql 初始执行文件的使用介绍

Mysql实例mysql 初始执行文件的使用介绍,第1张

概述介绍《Mysql实例mysql 初始执行文件的使用介绍》开发教程,希望对您有用。

《MysqL实例MysqL 初始执行文件的使用介绍》要点:
本文介绍了MysqL实例MysqL 初始执行文件的使用介绍,希望对您有用。如果有疑问,可以联系我们。

MysqL必读可以在配置文件里指定MysqL启动以后初始执行的sql文件,其语法是:
在[MysqLd]或者[server]下指定:
init-file=D:\MysqL-5.5.28-winx64\abc.sql,后边为具体的sql文件值
注意下边两点就行了:
1. 确保你的MysqLd 编译的时候没有加 --disable-grant-options 开关.
2. 确保init-file指定的脚本每行是一个具体的可以执行的语句.
为了示例:
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;

启动完MysqL以后,得到查询:
代码如下:
MysqL> use test;
Database changed
MysqL> select * from t123;
+------+
| ID |
+------+
| 1 |
| 2 |
+------+
2 rows in set (0.00 sec)

第二次启动以后,得到结果:
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,2012,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)
总结

以上是内存溢出为你收集整理的Mysql实例mysql 初始执行文件的使用介绍全部内容,希望文章能够帮你解决Mysql实例mysql 初始执行文件的使用介绍所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/1164162.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-01
下一篇2022-06-01

发表评论

登录后才能评论

评论列表(0条)

    保存