Search code examples
mysqllamp

mysql error at root password generation, Table 'mysql.user' doesn't exist'


I make a fresh install of lamp on my server (kubuntu distribution) but when I install it, I doesn't have to specify password for root user or something. I tried to purge mysql-server and then reinstall it without success.

When I try to make a sudo mysqladmin -u root password -p "", terminal return me this error : mysqladmin: unable to change password; error: 'Table 'mysql.user' doesn't exist'

Maybe I missed removing something before mysql-server install (I had an another error before because my partition was full and that's broke my install).

Thanks in advance for your time.

Edit :

I tried again a remove purge on mysql*, autoremove and then apt-get install mysql-server.

Now I get this error during the installation :

    start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                                                            Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit two :

I tried all this method and it doesn't work too. Maybe I miss something about linux distribution specification or something.

Edit three :

I purge again, remove /var/lib/mysql folder and error disappear. But the command doesn't allow me to type any password or something for basic configuration.


Solution

  • I understand your frustration, as I repeatedly went through the same process. In fact your thoughts are correct when you stated "Maybe I missed removing something before mysql-server install."

    There is a known bug when attempting to purge and remove mysql. It may be that package dependency config files are still remaining once the purge is complete.

    Reference to the MySQL Bug #72722 is a known solution, and ultimately what worked for myself.

    Again repeat the removal process:

    sudo apt-get remove --purge mysql-server mysql-client mysql-common
    sudo apt-get autoremove
    sudo apt-get autoclean
    sudo rm -rf /var/lib/mysql
    sudo rm -rf /etc/mysql
    sudo rm -rf /var/log/mysql
    

    Once the above commands are complete, run the following command to check the current state of all the mysql packages:

    sudo dpkg -l | grep mysql
    

    If you see anything populated in the list, these must be purged before reinstall. Examples of codes will be ii (installed), rc (removed config-files kept), or ic (installed config files). The package name is to the right of these flags. Copy each one and run the following command one by one:

    sudo apt-get purge <package-name-here>
    

    Once the list is emptied you may then install MySQL on Ubuntu without error

    sudo apt install mysql-server mysql-client