A couple of questions for any Mac users willing to help:

I have created an application for OS X.3 that talks to the MySQL server with
shell commands.  In order for those commands to work, I have to include a
proper username and password to access the MySQL database designated for my
app within the shell command each time a shell command is sent.  Assuming
that there is no way around this (the security feature being necessary for
internet and corporate use but not necessary for my purposes),  I have to:

1. On installation of my app, have the user provide their MySQL root
password.
2. Create the database for the application using the root password and then
GRANT priveleges to a username and password on that database (predefined in
my code).

What I am having trouble with is the proper language to do the following:

If the user doesn't know their root password, and chooses to reset the root
password, given variable rootPassword (what they entered):

do shell script "kill cat /usr/local/mysql/bin/mysql/data/localhost.pid"
do shell script "/usr/local/mysql./bin/mysqld_safe --skip-grant-tables &"
do shell script "/usr/local/mysql/bin/mysqladmin -u root flush-priveleges
password '"&rootPassword&"'"
do shell script "/usr/local/mysql/bin/mysqladmin shutdown
do shell script "/usr/local/mysql./bin/mysqld_safe"
do shell script "/usr/local/mysqlbin/mysql -h localhost -u root --password =
'"&rootPassword&"' -e \"CREATE DATABASE IF NOT EXISTS theDatabase/""
do shell script "/usr/local/mysqlbin/mysql -h localhost -u root --password =
'"&rootPassword&"' -e \"GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER,
CREATE ON theDatabase.* TO [EMAIL PROTECTED] IDENTIFIED BY 'pswd'\""

I can't get past the first line.  Any ideas what is wrong with it?

In the larger picture, I am wondering if there is a way to avoid all of
this.  Ideally, I would like for the application to come packaged with
MySQL, to install MySQL automatically (not sure what happens if MySQL
already exists on the system), and to never ask the user for a password.  In
fact, to just run MySQL in the background as if it were a part of my
application.  Any ideas on this?  However, in the short term, in order to
get it all working on my own computer I will need to get the above language
correct.

Thanks for any input!

-John


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to