下面是写的数据库初始化脚本
dbinit.sh
#!/bin/bash mysql -u root -p${password} <<EOF use ${database}; drop user if exists '${username}'@'%'; flush privileges; create user ${username}identified by '${password}'; grant all privileges on ${username}.* to ${username}@'%' identified by '${password}'; flush privileges; source ./createTable.sql source ./initTable.sql exit EOF |
下面是基于windows的mysql数据库导出
mysqldump -u${username} -p${password} -h${hostip} ${databasename} --hex-blob --default-character-set=gbk > d:/xxxx.sql