0

I install MySql Server and MySql Client on my Ubuntu 16.04.1 from "Ubuntu Software Center".

As far as I know, when you install mysql-server from terminal, it prompt for root password in the middle of installation process. But when I install it from "Ubuntu Software Center", it just installed and I don't know what the root password is.

koceeng
  • 145
  • 1
  • 8
  • 7
    You can set the root password after installation. Check [this](http://askubuntu.com/questions/766900/mysql-dont-ask-for-root-password-when-installing/767252#767252) answer – d a i s y Dec 31 '16 at 06:17
  • try runnig this `sudo mysql_secure_installation` and see if you'll be asked to put in a _password_ . – George Udosen Dec 31 '16 at 06:25
  • @daisy and George Great, thank you. Would any of you make that as an answer so that I can accept it? – koceeng Dec 31 '16 at 07:01
  • or make this question as duplicate, it is okay – koceeng Dec 31 '16 at 07:01

1 Answers1

2

Here is how to stop/kill the existing mysql daemon, in case it is running:

 sudo  ps -ef | grep mysql      - checks if mysql/mysqld is one of the running processes.

 sudo kill -9 'pid' mysqld             - kills the daemon, if it is running.

Run MySQL safe daemon with skipping grant tables

 sudo mysqld_safe --skip-grant-tables &

Login to MySQL as root with no password

 sudo mysql -u root mysql

Run UPDATE query to reset the root password

  UPDATE user SET authentication_string=PASSWORD("MyNewPassword") WHERE user="root";
  FLUSH PRIVILEGES;

Stop MySQL safe daemon

 sudo  ps -ef | grep mysqld_safe 
 sudo kill -9 'pid' mysqld_safe

Start MySQL daemon

sudo /etc/init.d/mysql start

Privileges are flushed. Start MySQL and login as root with the password you reseted

 sudo mysql -u root -p mysql
Arduino_Sentinel
  • 1,747
  • 10
  • 17