mysql自动执行脚本


linux-shell脚本执行sql脚本

#!/bin/bash

echo "start init db, create_tables & init_tables"

service mysqld stop

sleep 1

service mysqld start

sleep 1 

db_curr=`pwd`

mysql <<EOF

source ${db_curr}/db_script/create_tables.sql;

source ${db_curr}/db_script/init_tables.sql;

use mysql;

update user set password=password("123456") where user='root';

flush privileges;

EOF


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM