Re: Best method for stopping/starting MySQL?
--- On Mon, 10/19/09, Jari Fredriksson <jarif@iki.fi> wrote:
> From: Jari Fredriksson <jarif@iki.fi>
> Subject: Re: Best method for stopping/starting MySQL?
> To: debian-user@lists.debian.org
> Date: Monday, October 19, 2009, 1:15 PM
>
>
> 19.10.2009 20:49, Tim Legg kirjoitti:
> > Hello again!
> >
> > I would like to shutdown mysql periodically to make
> backups of the databases. I would like to know what is
> the official Debian way of stopping and restarting MySQL.
> >
> >
> >
> > When I follow the intuitive steps for shutting it
> down, it doesn't work.
> >
> > # /etc/init.d/mysql stop
> > Stopping MySQL database server: mysqld failed!
> >
> > So I investigate further and find that this doesn't
> work either
> >
> > # mysqladmin shutdown
> > mysqladmin: connect to server at 'localhost' failed
> > error: 'Access denied for user 'root'@'localhost'
> (using password: NO)'
> >
> > I am root and should be able to do anything...
> >
> > So I do cooperate and provide it a user and password
> >
> > # mysqladmin -u root -p shutdown
> > Enter password:
> > #
> >
> > And so it works. Starting it back up isn't
> nearly as clean though
> >
> > # /etc/init.d/mysql start
> > Starting MySQL database server: mysqld.
> > Checking for corrupt, not cleanly closed and upgrade
> needing tables..
> > /usr/bin/mysqladmin: connect to server at 'localhost'
> failed
> > error: 'Access denied for user
> 'debian-sys-maint'@'localhost' (using password: YES)'
> > ERROR 1045 (28000): Access denied for user
> 'debian-sys-maint'@'localhost' (using password: YES)
> >
> > So, I choose to reboot the system instead. Is
> there a better way?
> >
>
> Something is broken in your installation.. Do you have
>
> /etc/mysql/debian.cnf
>
It exists.
> And the password there.
>
It has a password
> If you log in to the MySQL as root, and
>
> mysql> select User, Host from
> mysql.user;
>
> Is the debian-sys-maint there? With the password you have
> in the
> debian.cnf? And Host as 'localhost'?
>
Yes,
select User, Host, Password from mysql.user;
revealed the password. I diff'd the two passwords and ensured they are correct. But I noticed something wasn't quite right.
My output is similar to this (Thanks to grc.com password generator).
+------------------+-----------+-------------------------------------------+
| User | Host | Password |
+------------------+-----------+-------------------------------------------+
| root | localhost | *4883CCF9DC8AAC41CBE1576EE7C30ECFFDB1EE23 |
| debian-sys-maint | localhost | 2qcvaMBnP8qwm5Ik |
| legg | localhost | *FA5726D8387429018CC8BE7FACBC43F1E51D5C2F |
+------------------+-----------+-------------------------------------------+
I see the password in plain text while the others are in a hash of some sort. That is probably where the problem is, and now I need to find a solution.
> You can change the password with command
>
> mysql> update mysql.user set
> password=PASSWORD('new-password')
> where User =
> 'debian-sys-maint' ;
> mysql> flush privileges;
>
>
>
Also thanks to Joe for the mysqldump suggestions. I have just implemented that as a solution. Now to fix this password problem...
Tim Legg
Reply to: