[chef] Re: Re: mysql and root password


Chronological Thread 
  • From: S Ahmed < >
  • To:
  • Subject: [chef] Re: Re: mysql and root password
  • Date: Mon, 16 Apr 2012 10:01:07 -0400

Andrea,

Thanks for clearing that up, I see the root password now :)

Question is, how can I read it from that file, do you mean this could be automated somehow?

I don't plan on remote connecting to my mysql server anyhow, so was hoping there was a way I could hard code the password.  David says he tried and it didn't work, do you konw what the issue might be?

thanks!

On Mon, Apr 16, 2012 at 2:51 AM, Andrea Campi < "> > wrote:
The answer is in the very log file you quoted:
The cookbook generated the password and then stored it in a /etc/mysql/grants.sql file. Do not change it; just read it from there and use that one.


On Apr 16, 2012, at 4:47 AM, S Ahmed < "> > wrote:

> Confused how I should be handling the root password with the mysql recipe.
>
> After it installed, I couldn't access the mysql instance since I didn't know the password.
>
> 1. I stopped the mysql service.
> 2. mysqld_safe --skip-grant-tables &
> 3. mysql -u root
> changed password for root
> 4. tried to stop the mysql server:
>
> sudo /etc/init.d/mysql stop
> Rather than invoking init scripts through /etc/init.d, use the service(8)
> utility, e.g. service mysql stop
>
> Since the script you are attempting to invoke has been converted to an
> Upstart job, you may also use the stop(8) utility, e.g. stop mysql
>
> How can I stop it?  (I got around it by killing the process via kill -9 1234)
>
> 5. started the service up again, my root password now works.
>
>
> ***But now, if I re-run my chef-solo script, I get this:
>
> [Mon, 16 Apr 2012 02:43:09 +0000] ERROR: Running exception handlers
> [Mon, 16 Apr 2012 02:43:09 +0000] ERROR: Exception handlers complete
> [Mon, 16 Apr 2012 02:43:09 +0000] FATAL: Stacktrace dumped to /home/ubuntu/chef/chef-stacktrace.out
> [Mon, 16 Apr 2012 02:43:09 +0000] FATAL: Chef::Exceptions::ShellCommandFailed: execute[mysql-install-privileges] (mysql::server line 136) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '1'
> ---- Begin output of /usr/bin/mysql -u root -p"QNX7GkHcx7cbU65BYxGb" < /etc/mysql/grants.sql ----
> STDOUT:
> STDERR: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
> ---- End output of /usr/bin/mysql -u root -p"QNX7GkHcx7cbU65BYxGb" < /etc/mysql/grants.sql ----
> Ran /usr/bin/mysql -u root -p"QNX7GkHcx7cbU65BYxGb" < /etc/mysql/grants.sql returned 1
>
> I guess it is generating a random password and trying to login somehow, what should I change now?




Archive powered by MHonArc 2.6.16.

§