首先,您必须停止冲突的 MySQL 服务进程,然后您可以使用此命令行创建数据库。我确定 InnoSetup 提供对 shell 执行的访问。
mysql.exe --user=myid --password=mypwd --silent --force < CREATEDB.sql
创建数据库.sql
CREATE DATABASE mydb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_swedish_ci;
USE mydb;
CREATE TABLE table1 (
id bigint NOT NULL auto_increment,
name varchar(64) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE (name)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_swedish_ci;
Insert Into table1 (name) Values('default row 1');
Insert Into table1 (name) Values('default row 2');
GRANT ALL PRIVILEGES ON * TO 'mydbadmin'@'localhost' IDENTIFIED BY 'mydbadminpwd';