mysql 忘記密碼

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

#service mysql stop
#service mysql start
#mkdir -p /var/run/mysqld
#chown mysql:mysql /var/run/mysqld
#mysqld_safe –skip-grant &
#mysql -uroot mysql

mysql 5.7 以上
UPDATE mysql.user SET authentication_string=PASSWORD('dcV4XgJPgU'), plugin='mysql_native_password' WHERE User='root' ;
FLUSH PRIVILEGES;