Mysql启动时执行文件init-file的使用
可以在配置文件里指定mysql启动以后初始执行的SQL文件, 其语法是:
在[mysqld]下指定:
init-file="D:/mysql/test.sql", 后面为具体的sql文件值。
注意下边两点就行了:
1. 确保你的mysqld 编译的时候没有加 --disable-grant-options 开关。
2. 确保init-file指定的脚本每行是一个具体的可以执行的语句。
废话不多说(上面截图我使用的mysql7)。直入正题:test.sql为:
use test; begin; create table if not exists test123(id int); insert into test123 values(1); insert into test123 values(2); select * from test123; -- drop table test123; end;
启动完mysql以后,得到查询可以看到
无论从事什么行业,只要做好两件事就够了,一个是你的专业、一个是你的人品,专业决定了你的存在,人品决定了你的人脉,剩下的就是坚持,用善良專業和真诚赢取更多的信任。