Ubuntu 18.04 mysql password reset

1

Stop mysql, reboot and bypass security detection

sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &

2

If the '/ var / run / mysqld' appears for UNIX socket file do not exists

mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld

直到 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

3

use mysql;

update user set authentication_string=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit

5.7

https://blog.csdn.net/lynnyq/article/details/80296137
restart the server

Guess you like

Origin www.cnblogs.com/develon/p/10955240.html