[CentOS] restarting mysql databases

Mon Oct 6 20:01:24 UTC 2014
Robert Moskowitz <rgm at htt-consult.com>

On 10/06/2014 03:27 PM, Reindl Harald wrote:
>
>
> Am 06.10.2014 um 21:24 schrieb Robert Moskowitz:
>>
>> On 10/06/2014 03:08 PM, Reindl Harald wrote:
>>>
>>> Am 06.10.2014 um 21:01 schrieb Robert Moskowitz:
>>>> I am doing an install of a mysql system, and decided that I needed to
>>>> change some things like host name.  So I have to go back to square one
>>>> with the mysql setup, but can't find any instructions for this. I 
>>>> TRIED:
>>>>
>>>> mysql_install_db
>>>>
>>>> And it did SOMETHING, but
>>>>
>>>> mysqladmin -u root password 'mypass'
>>>>
>>>> failed with:
>>>>
>>>> mysqladmin: connect to server at 'localhost' failed
>>>> error: 'Access denied for user 'root'@'localhost' (using password: 
>>>> NO)'
>>>>
>>>> I tried 'yum reinstall mysql' and that did not help
>>>
>>> why should "yum reinstall" change anything?
>>
>> Some apps reinit there data on reinstalls.  Some don't.  Don't know
>> until you try.
>
> no they don't
>
> /var/lib/appname/ is never part of the package
> otherwise update swould touch/damage your data
>
>>> the daemon specific data are below /var&/lib/mysql as for
>>> any other software they live below /var/ib/appname
>>>
>>> no command ever will reset them besides rm -rf /var/lib/mysql/
>>> but what has that all to do with change the hostname?
>>
>> Don't know what changing the hostname did or does not do.  I am digging
>> into various info to figure out what to delete or rebuild to get back to
>> pristine mysql.  I can understand why this should not be easy - for
>> someone to remove all of your mysql data, but it should be possible...
>
> if you have no data:
>
> * stop the service
> * rm -rf /var/lib/mysqld/*

Looks like the files:

/var/lib/mysql/mysql/user.MYD
/var/lib/mysql/mysql/user.MYI
/var/lib/mysql/mysql/user.frm

have the goo that has to go.

> * start the service
> * you have a virgin setup
>
> and as always read some docs
> http://dev.mysql.com/doc/refman/5.5/en/privilege-system.html
>
>