0

I installed MySQL 5.7.26 on Ubuntu 18.04, but cannot login or reset 'root' user password. I tried all the ways from the two top answers to this post, but with no success.

  1. There is no /var/log/mysqld.log file on my machine so I cannot find the temporary password.
  2. Changing the root password with mysql_secure_installation does not work.
  3. sudo mysqld_safe --skip-grant-tables & exist immediately.

  4. Tried setting the root password with mysql -u debian-sys-maint -p, but after I logout and then login back there is still auth_socket in MySQL.user table (for some reason UPDATE user SET plugin='mysql_native_password' WHERE User='root'; does not take an effect), even if I do flush privileges and commit.

EDIT1:

Also tried this but

sudo su - mysql
mysqld --init-file=/home/me/mysql-init &

exits immediately and in /var/log/mysql/error.log I have this:

2019-06-12T14:16:16.870292Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2019-06-12T14:16:16.870295Z 0 [ERROR] Unable to setup unix socket lock file.
2019-06-12T14:16:16.870298Z 0 [ERROR] Aborting

directory /var/run/mysqld/ does not exist, but it is created if I do sudo service mysql start and deleted with I do sudo service mysql stop

The same situation with sudo mysqld_safe --skip-grant-tables &:

Directory '/var/run/mysqld' for UNIX socket file don't exists.

EDIT2:

Tried on a clean Ubuntu 18.04 installation with the same result and did not find anything with

sudo grep -r 'temporary password' / --include=*.log

I also tried to create the directory as described here (with 'mysql' owner), but got 'permission denied' in logs, with file 'mysql-init' (also with 'mysql' owner').

Alexey Starinsky
  • 3,699
  • 3
  • 21
  • 57
  • 1
    did you try https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html? – Ntwobike Jun 12 '19 at 13:52
  • @Ntwobike yes, see EDIT1, probably something is wrong with unix socket. – Alexey Starinsky Jun 12 '19 at 14:23
  • I think it is a permissions error, though I haven't messed with mysql in several years. See if the mysql user has access to create `/var/run/mysqld/mysqld.sock.lock`. – Paul J Jun 12 '19 at 16:19
  • #3 it's supposed to; that launches the daemon - you then go in (you won't be made to login) and use the normal password setting facilities - then shut down the daemon and relaunch it normally – Lightness Races in Orbit Jun 12 '19 at 16:23
  • @PaulJ 'mysql' user is the owner of this file if MySQL is started normally. see also EDIT2 – Alexey Starinsky Jun 12 '19 at 16:36
  • 1
    @AlexeyStarinsky 1. You can also increase your log verbosity to possibly get a better idea of what's going on. https://stackoverflow.com/questions/37992813/logging-verbosity-mysql-5-7 // 2. I'd try to experiment doing: `sudo chown mysql.mysql /var/run/mysqld/mysqld.sock.lock && sudo chmod 777 /var/run/mysqld/mysqld.sock.lock` then restarting it, definitely NOT how you would want to do it in production. // 3. The only other guess I can make is mysql is already running, though I'm REALLY grasping for straws with that, `ps aux | grep mysql`. – Paul J Jun 12 '19 at 20:06
  • @PaulJ 2. socket files are removed with the service is stopped. 3. As far as I see, mysql_secure_installation requires mysqld to be running. – Alexey Starinsky Jun 12 '19 at 20:54

0 Answers0