I want a blank mysql password on my new Ubuntu 16.04 development machine the same as I've had on previous machines. It plays well with my existing local ruby on rails apps configuration files which use root.
I start with
sudo apt-get install mysql
then I can use
service mysql start
and when I use
ps aug | grep mysql
I see the process running
mysql 24618 6.5 1.6 1230276 133536 ? Ssl 19:03 0:00 /usr/sbin/mysqld
I stop it with
service mysql stop
and then I use
sudo mysqld_safe --skip-grant-tables
and in another window I do
mysql>
mysql> UPDATE mysql.user SET authentication_string = ''
-> WHERE User = 'root' AND Host = 'localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
I then use
sudo kill -9 [pid_of_mysqld_safe]
and then
service mysql start
to start it normally but when I try
mysql -u root
I get
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I also tried using an actual string instead of '' for the password but still had the same issue
I've gone through
https://help.ubuntu.com/lts/serverguide/mysql.html
and
https://ubuntuforums.org/showthread.php?t=2275033
and
https://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-16-04/
and
http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
but they haven't helped, I get the same error.
$ sudo systemctl status mysql
shows
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2016-08-24 20:04:49 EDT; 4min 39s ago
Process: 9018 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 9013 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 9017 (mysqld)
CGroup: /system.slice/mysql.service
└─9017 /usr/sbin/mysqld
Aug 24 20:04:48 Ubuntu2016 systemd[1]: Starting MySQL Community Server...
Aug 24 20:04:49 Ubuntu2016 systemd[1]: Started MySQL Community Server.