Hello, I am having a weird problem with some sql that is supposed to set up a DB for me. When I run the .sql file manually from the command line like this: mysql --user=root < DB_init.sql It works fine. But when I do the same command from a shell script that is run during the kickstart setup of the server, it seems to be stopping processing of the file after the first grant statement. I changed the command to:
mysql --user=root -v -v -v < DB_init.sql to try to get some indication of what mysql is doing and why it's stopping, but that didn't tell me much. It just showed me where it was stopping (after the first grant statement), but didn't seem to provide any answer as to why. Here's the DB_init.sql script that I'm trying to run (this is run during kickstart setup to set up a DB and some tables on the server): ====DB_init.sql begin==== # create users CONNECT mysql; # perl user REPLACE INTO user (host, user, password) VALUES ( 'localhost', 'vsperl', '<encrpyted passwd>' ); REPLACE INTO db (host, db, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv) VALUES ( 'localhost', 'RelayStats', 'vsperl', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y' ); # php user REPLACE INTO user (host, user, password) VALUES ( 'localhost', 'vsphp', '<encrpyted passwd>' ); REPLACE INTO db (host, db, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv) VALUES ( 'localhost', 'RelayStats', 'vsphp', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y' ); # database creation CREATE DATABASE RelayStats; CONNECT RelayStats; # # Table structure for table `host` # CREATE TABLE `host` ( `id` float NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `ip` varchar(255) default NULL, PRIMARY KEY (`id`), KEY `Name` (`name`) ); # # Table structure for table `stats` # CREATE TABLE `stats` ( `id` float NOT NULL auto_increment, `host_id` float NOT NULL default '0', `virus_id` float NOT NULL default '0', `date` date NOT NULL default '0000-00-00', `time` time NOT NULL default '00:00:00', PRIMARY KEY (`id`), KEY `Host_Id` (`host_id`,`virus_id`), KEY `date` (`date`), KEY `Timestamp` (`time`) ); # # Table structure for table `virus` # CREATE TABLE `virus` ( `id` float NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `date_added` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `Name` (`name`), KEY `date_added` (`date_added`) ); # grant permissions on all the tables #GRANT SELECT, UPDATE, INSERT, DELETE ON <table> to <user>; GRANT SELECT, UPDATE, INSERT, DELETE ON host to [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; GRANT SELECT, UPDATE, INSERT, DELETE ON host to [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; GRANT SELECT, UPDATE, INSERT, DELETE ON stats to [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; GRANT SELECT, UPDATE, INSERT, DELETE ON stats to [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; GRANT SELECT, UPDATE, INSERT, DELETE ON virus to [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; GRANT SELECT, UPDATE, INSERT, DELETE ON virus to [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ; FLUSH PRIVELEGES; # done. ====DB_init.sql end==== And the output from mysql ends like this: ====begin mysql output==== -------------- CREATE TABLE `virus` ( `id` float NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `date_added` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `Name` (`name`), KEY `date_added` (`date_added`) ) -------------- Query OK, 0 rows affected (0.00 sec) -------------- GRANT SELECT, UPDATE, INSERT, DELETE ON host to [EMAIL PROTECTED] -------------- Bye ====end mysql output==== Does anybody have any idea why it's just stopping after that first Grant statement? And why it works when I run it manaully, but for some unknown reason doesn't work during the kickstart install? thx! k