0

Setting. I'm running Ubuntu 15.04 on a custom machine with an existing PHP / Apache / Sqlite setup. I recently installed MySql to fiddle around with Laravel a bit. It was working perfectly until I wasn't paying attention and did something incredibly stupid. I intended to export all of the user's privileges to a new database, was in a hurry, and instead clicked the button to dump all users. So, yeah. Complete dumped every user in MySql, including root. Obviously I was unable to log back in with PhpMyAdmin, because no root user. Since this was just a testing install I went ahead and purged MySql and re-installed, thinking it would just go through the install process again. NOPE. I've uninstalled / reinstalled using the terminal, synatpic, and Ubuntu Software Center. In each case the install of MySql client server just breezes through without even asking for a root user. I can't even check status to see if the server is running without getting an unauthorized error. I would really like to get this fixed, but without uninstalling apache2 and php. Any help would be greatly appreciated.

After yet another purge / install cycle I have mysql mostly working again. I can log in as root from the command line, and I am able to log in via PhpMyAdmin, for the most part. Unfortunately, while I seem to still have all of the necessary PhpMyAdmin functionality the page itself throws several iterations of the following error:

Connection for controluser as defined in your configuration failed.

I've researched this error and none of the conditions that are said to cause it exist in my system.

Blind Fish
  • 998
  • 4
  • 14
  • 25

1 Answers1

2

First try this.

mysql -u root -p password

if first method does not work then use following method to reset your MySQL password.

  1. Check your version of the MySQL database.

    apt-cache policy mysql-server

  2. Start configuration setting of the MySQL database.

    sudo dpkg-reconfigure mysql-server-** . **

    "replace ** . ** with your MySQL database version"

It will open a configuration prompt where you will can change password.

If both of the above methods fails then use this method as last resort.

  1. Stop your MySQL database server

    sudo /etc/init.d/mysql stop

  2. Start demon process without grant table.

    sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking

  3. Start MySQL and flush the privilige.

    mysql -u root

    FLUSH PRIVILEGES;

  4. Now set the password for the root user.

    USE mysql

    UPDATE user SET Password = PASSWORD('newpwd')

    WHERE Host = 'localhost' AND User = 'root';

Ismail Zafar
  • 174
  • 1
  • 11